>> Find the key-sequence corresponding to it with C-h k, then
>> (define-key [theseysequence] '(menu-item ...)).
>> See the elisp manual's description of menus and `menu-item' for more info.

> OK, but I wouldn't want to contruct a completely new menu-item, I would just
> want to exchange the text. Now, when I do something like

> (lookup-key global-map [menu-bar file open-file])

> all I get is the pure command, 'find-file-existing, in this case - but not
> the arguments :enable and :help that were defined in menu-bar.el:

Yes, that's a problem I'm familar with.  It should be pretty easy to fix,
all we need is a way to tell lookup-key to return the "raw" binding.
Please send a feature request to gnu.emacs.bug about it.

As a workaround you can try

   (cdr (assq 'open-file (lookup-key global-map [menu-bar file])))

which will probably work in most cases.  Note that doing a `setcar' or
`setcdr' operation on the menu-item you found, tho appealing, should be
avoided since it may fail (this data is often located in pure-storage
which is readonly).  Instead you'll have to reconstruct a new menu-item with
most of the content unchanged, using non-destructive operators like
`append', `cons', ...


        Stefan


_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to