RE: capi and remote listeners
Following up here. It looks like I need to add the appropriate gestures to
the listener-pane's input model. After playing around, I got this to work:
(defmethod initialize-instance :after ((self administrator) &rest args)
(let ((pane (kbsd-listener self)))
(setf (capi:output-pane-input-model pane)
(append (capi:output-pane-input-model pane)
'(((:gesture-spec #\p :meta :press) previous-history))))))
(defmethod capi:interface-keys-style ((self administrator))
:emacs)
(defun previous-history (&rest args)
(format t "previous-history: ~S~%" args))
If there's a better way, or if this is wrong, please educate me. Thanks...
#'dey
-----Original Message-----
From: Young, David [mailto:dyoung@bloodhoundinc.com]
Sent: Thursday, March 13, 2003 1:16 PM
To: 'davef@xanalys.com'
Cc: lisp-hug@xanalys.com
Subject: RE: capi and remote listeners
The issue appears to be our custom toplevel function. I ran your example
without providing a toplevel function and history works. If I provide a
toplevel that simply does the following:
(defun kbsd-toplevel (interface pane strm)
(loop
(princ (eval (read strm)) strm)))
I get the behavior originally reported.
So, what is the proper way to define a custom toplevel function?
#'dey
-----Original Message-----
From: David Fox [mailto:davef@xanalys.com]
Sent: Thursday, March 13, 2003 1:05 PM
To: dyoung@bloodhoundinc.com
Cc: lisp-hug@xanalys.com
Subject: Re: capi and remote listeners
Hi Dave. That made sense to me; but alas, it doesn't solve the problem.
Basically, I have this:
(define-interface administrator ()
(...)
(:panes
(...)
(kbsd-listener listener-pane
:top-level-function #'kbsd-toplevel
:enabled nil
:reader kbsd-listener))
...)
(defmethod capi:interface-keys-style ((self administrator))
:emacs)
When I start the app, my interface-keys-style method gets called, but the
behavior of the listener doesn't change. Note that initially, the
listener
pane is disabled. It's enabled programatically once a connection is made.
I don't think the enabled state is relevant, though you should take
care to set it in the correct process.
What do you think?
Works for me in the LispWorks IDE with this code:
(capi:define-interface administrator () ()
(:panes
(kbsd-listener capi:listener-pane
; :top-level-function #'kbsd-toplevel
:enabled nil
:reader kbsd-listener))
)
(defmethod capi:interface-keys-style ((self administrator))
:emacs)
CL-USER 7 > (setf administrator (capi:contain (make-instance
'administrator)))
#<ADMINISTRATOR "Untitled LispWorks Interface - 9" 205F96D4>
CL-USER 8 > (capi:execute-with-interface administrator #'(lambda (self)
(setf (capi:simple-pane-enabled (kbsd-listener self)) t)) administrator)
NIL
Now M-P works in the administrator listener window.
If you are delivering a standalone application you need to pass the
DELIVER keyword :EDITOR-STYLE :EMACS to override the platform default,
and at high deliver levels it seems you need to ensure that the
required editor functionality is retained. Here's example code and a
DELIVER script that produces an administrator listener application in
which M-P works:
---------------------- administrator.lisp ----------------------------
(in-package CL-USER)
(capi:define-interface administrator () ()
(:panes
(kbsd-listener capi:listener-pane
:enabled nil
:reader kbsd-listener)))
(defmethod capi:interface-keys-style ((self administrator))
:emacs)
(defun set-enabled (self on)
(setf (capi:simple-pane-enabled (kbsd-listener self)) on))
(defun start-administrator ()
(let ((administrator (capi:display (make-instance 'administrator))))
(sleep 1)
(capi:execute-with-interface administrator 'set-enabled
administrator t)))
----------------------------------------------------------------------
------------------------ deliver.lisp --------------------------------
(in-package "CL-USER")
(load-all-patches)
(load (current-pathname "administrator" "fsl"))
(deliver 'start-administrator "administrator" 5
:interface :capi
:keep-top-level t
:editor-style :emacs
:editor-commands-to-keep '(:simple-editor :tools))
(quit)
----------------------------------------------------------------------
Dave Fox
Xanalys
Compass House
Vision Park
Chivers Way
Histon
Cambridge
CB4 9AD
England
Email: davef@xanalys.com
Tel: +44 1223 253793
Fax: +44 1223 257812
These opinions are not necessarily those of Xanalys.