[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Is defobfun broken?
- To: info-macl@cambridge.apple.com
- Subject: Is defobfun broken?
- From: sbchanin@ai.mit.edu (Steve Chanin)
- Date: Tue, 21 Aug 90 16:03:03 EDT
- Reply-to: sbchanin@ai.mit.edu
The documentation for menu updates in 1.3 says (page 85):
The update routine is very simple: the object function menu-update is
run in every installed menu. The default version of menu-update runs
menu-item-update on each of its menu items. You can install update
behavior for a menu or menu item by defining special versions of
menu-update or menu-item-update.
I'd like to install special update behavior for the "Code" menu which I'm
creating, so I [code included below] (1) create the menu, (2) ask it to
install itself, (3) define the update function (simplified here to simply
ed-beep), and finally (4) either defobfun or ask it to fhave
code-update-function as its menu-update function. However, now every menu
beeps when I click in the menu bar. When I inspect other menus, only
*code-window-menu* has a binding for menu-update, but they all have the
same behavior? Similarly, when I reset the menu-update function for
*code-window-menu* to usual-menu-update, everything goes back to normal.
What's going on?
Thanks,
Steve
-----------------------------------------------------------------------------
;;; -*- Package: User; Language: Lisp; Syntax: Common-Lisp -*-
(in-package 'user)
(setq *code-window-menu* (oneof *menu* :menu-title "Code"))
(ask *code-window-menu* (menu-install))
(defun code-update-function ()
(ed-beep))
;(defobfun (menu-update *code-window-menu*) ()
; (code-update-function)
(ask *code-window-menu*
(fhave 'menu-update #'code-update-function))
(defobfun (menu-update *code-window-menu*) ()
(usual-menu-update))