home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / lisp / mcl / 2072 < prev    next >
Encoding:
Text File  |  1993-01-21  |  2.7 KB  |  82 lines

  1. Newsgroups: comp.lang.lisp.mcl
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!news.ils.nwu.edu!dmerrill.ils.nwu.edu!dmerrill
  3. From: Douglas C. Merrill <dmerrill@ils.nwu.edu>
  4. Subject: Nasty interaction of toplevel and menu-items
  5. Message-ID: <1993Jan21.204221.27174@ils.nwu.edu>
  6. X-Xxmessage-Id: <A7846CF0970164D8@dmerrill.ils.nwu.edu>
  7. X-Xxdate: Thu, 21 Jan 93 21:08:32 GMT
  8. Sender: usenet@ils.nwu.edu (Mr. usenet)
  9. Nntp-Posting-Host: dmerrill.ils.nwu.edu
  10. Organization: The Institute for the Learning Sciences
  11. X-Useragent: Nuntius v1.1.1d13
  12. Date: Thu, 21 Jan 1993 20:42:21 GMT
  13. Lines: 67
  14.  
  15. Hi to all...
  16.  
  17. I've been working on a small program that replaces the toplevel loop with one
  18. of my 
  19. own.  However, I'm doing something wrong (aargh)!  When I take over the loop, 
  20. anything typed into the Listener gets listened to correctly, but any function
  21. called from a 
  22. menu-item that contains a (format t ) breaks in an odd way.  Basically, it
  23. looks like the 
  24. output of the format calls are being evaluated.  So, if my menu calls a
  25. function (test), and 
  26. test contains a call (format t "This will break"), my toplevel responds 
  27. > Error: Unbound variable: THIS
  28. > While executing: SYMBOL-VALUE
  29. > Type Command-/ to continue, Command-. to abort.
  30. > If continued: Retry getting the value of THIS.
  31. See the RestartsU menu item for further choices.
  32. as if I had typed "This".  
  33.  
  34. Code to produce this error is below:
  35. ;;;; Toplevel code to show break
  36.  
  37. ;; set-top is an accessor function to set the toplevel routine
  38. ;; new-top is the new toplevel routine
  39.  
  40. (defun set-top (top-level-fn)
  41.    (%set-toplevel top-level-fn)
  42.    (throw :toplevel t))
  43.  
  44. (defun new-top (&aux form)
  45.    (format t "~&LISP> ")
  46.    (setq form (read))
  47.    (format t "~& ~a" (eval form)))
  48.  
  49. ;; now just create the test case
  50.  
  51. (defun test ()
  52.    (format t "This will break"))
  53.  
  54. (defparameter *stupid-menu* (make-instance 'menu
  55.                                                     :menu-title "Test"
  56.                                                     :menu-items
  57.                                                     (list
  58.                                                       (make-instance 'menu-item
  59.                                                           :menu-item-title
  60. "Breaks"
  61.                                                           :menu-item-action 
  62.                                                           #'(lambda ()
  63. (test))))))
  64.  
  65. (menu-install *stupid-menu*)
  66.  
  67.  
  68. I don't have any good ideas about what's going on -- maybe I'm confused about
  69. the 
  70. various streams?  Advice would be gratefully appreciated.
  71.  
  72.  
  73. Thanks,
  74.  
  75. Douglas Merrill
  76. Visiting Scholar
  77. The Institute for the Learning Sciences
  78. Northwestern University
  79. 1890 Maple Ave
  80. Evanston IL 60201
  81. dmerrill@ils.nwu.edu
  82.