Article View: comp.lang.lisp.mcl
Article #641Nasty interaction of toplevel and menu-items
From: Douglas C. Merrill
Date: Thu, 21 Jan 1993 20:42
Date: Thu, 21 Jan 1993 20:42
67 lines
2804 bytes
2804 bytes
Hi to all...
I've been working on a small program that replaces the toplevel loop with one
of my
own. However, I'm doing something wrong (aargh)! When I take over the loop,
anything typed into the Listener gets listened to correctly, but any function
called from a
menu-item that contains a (format t ) breaks in an odd way. Basically, it
looks like the
output of the format calls are being evaluated. So, if my menu calls a
function (test), and
test contains a call (format t "This will break"), my toplevel responds
> Error: Unbound variable: THIS
> While executing: SYMBOL-VALUE
> Type Command-/ to continue, Command-. to abort.
> If continued: Retry getting the value of THIS.
See the RestartsU menu item for further choices.
as if I had typed "This".
Code to produce this error is below:
;;;; Toplevel code to show break
;; set-top is an accessor function to set the toplevel routine
;; new-top is the new toplevel routine
(defun set-top (top-level-fn)
(%set-toplevel top-level-fn)
(throw :toplevel t))
(defun new-top (&aux form)
(format t "~&LISP> ")
(setq form (read))
(format t "~& ~a" (eval form)))
;; now just create the test case
(defun test ()
(format t "This will break"))
(defparameter *stupid-menu* (make-instance 'menu
:menu-title "Test"
:menu-items
(list
(make-instance 'menu-item
:menu-item-title
"Breaks"
:menu-item-action
#'(lambda ()
(test))))))
(menu-install *stupid-menu*)
I don't have any good ideas about what's going on -- maybe I'm confused about
the
various streams? Advice would be gratefully appreciated.
Thanks,
Douglas Merrill
Visiting Scholar
The Institute for the Learning Sciences
Northwestern University
1890 Maple Ave
Evanston IL 60201
dmerrill@ils.nwu.edu
Technical Details
Message-ID:
<1993Jan21.204221.27174@ils.nwu.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!news.ils.nwu.edu!dmerrill.ils.nwu.edu!dmerrillShow Full Headers
Complete Article Headers
Newsgroups: comp.lang.lisp.mcl Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!news.ils.nwu.edu!dmerrill.ils.nwu.edu!dmerrill From: Douglas C. Merrill <dmerrill@ils.nwu.edu> Subject: Nasty interaction of toplevel and menu-items Message-ID: <1993Jan21.204221.27174@ils.nwu.edu> X-Xxmessage-Id: <A7846CF0970164D8@dmerrill.ils.nwu.edu> X-Xxdate: Thu, 21 Jan 93 21:08:32 GMT Sender: usenet@ils.nwu.edu (Mr. usenet) Nntp-Posting-Host: dmerrill.ils.nwu.edu Organization: The Institute for the Learning Sciences X-Useragent: Nuntius v1.1.1d13 Date: Thu, 21 Jan 1993 20:42:21 GMT Lines: 67