Didier Verna <verna(a)inf.enst.fr> writes:
Jeff Miller <jmiller(a)smart.net> writes:
> (defun jdm-junk ()
> (add-submenu nil '("Hi") )
> )
> (make-local-hook 'activate-menubar-hook)
> add-hook 'activate-menubar-hook 'jdm-junk nil t)
>
> put this in your scratch buffer & eval-buffer. Then click on the menubar.
>
> I get the following error:
>
> Signaling: (void-function t)
> t()
make-local-hook adds `t' to the local variable to tell the hook's caller
to handle the default value as well. I guess that the
activate-menubar-hook's caller has not been updated to understand the
flag yet ?
the problem is that in pre_activate_callback in menubar-x.c:425, this
loops over the list of functions itself instead of calling Frun_rooks or
run_hook_with_args, so none of the logic about 't' being special is used.
The reason it does this is to give special semantics to the return value of
each function in the list (returning nil means it changed the menu).
Since activate-menubar-hook is considered mostly obsolete in the code,
and the variable documentation recommends using :filter anyway, it might
make sense to just change this to use Frun_hooks, and always assume the
menubar has changed. From the comments in the code, this would be safe,
but slightly more expensive computationally.
In the packages, etc, that I use, activate-menubar-hook is used in:
Sun/sccs.el *
Sun/sunpro-menubar.el *
rmail/rmail-xemacs.el *
edit-utils/recent-files.el *
auctex/latex.el
edit-utils/mode-motion+.el (not really, since function used doesn't work)
pcl-cvs/generic-sc.el
vm/vm-easymenu.el
lisp/easymenu.el
lisp/menubar-items.el
* = XEmacs only, so should use :filter anyway
Since Emacs 20.3 _finally_ supports :filter in the easymenu specs, all
these should probably be changed to using :filter in new releases anyway.
Emacs/W3 now uses :filter whenever possible.
Should VM still be distributing it's own version of easymenu? It hasn't
been changed in over 3 years, and I know the FSF emacs one has. :)
The menubar-items stuff is in popup-menubar-menu, and just runs the hooks
(correctly), so can be ignored.
easymenu does something similar for if you call the function associated
with the menu directly (does anyone really do this?).
-Bill P.