RE: capi and remote listeners
I think this will work fine. The tip regarding editor:listener-top-level was the missing piece. Thanks; I'll give this a try... #'dey -----Original Message----- From: David Fox [mailto:davef@xanalys.com] Sent: Thursday, March 13, 2003 2:24 PM To: dyoung@bloodhoundinc.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. Ah, I see. I should have asked you for a complete example in the first place. So, what is the proper way to define a custom toplevel function? Depends what you want it to do :) You want a command history, so your top level function might need to implement it. However, if you can make it call EDITOR:LISTENER-TOP-LEVEL, then you'll get the history mechanism for free. If you need special evaluation behaviour, then you can pass :EVAL-FUNCTION as in my example below. ---------------------------------------------------------------------- (in-package CL-USER) (defun admin-eval-function (expr) (capi:display-message "Using Admin Eval Function") (eval expr)) (capi:define-interface administrator () () (:panes (kbsd-listener capi:listener-pane :enabled nil :reader kbsd-listener :top-level-function #'(lambda (i p s) (declare (ignore i p)) (editor:listener-top-level s :eval-function 'admin-eval-function))))) (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))) ---------------------------------------------------------------------- I hope that helps. 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.