[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
looking up a submenu keymap in a menu keymap, when the submenu key is a
From: |
Drew Adams |
Subject: |
looking up a submenu keymap in a menu keymap, when the submenu key is a string |
Date: |
Sun, 8 Oct 2006 11:34:59 -0700 |
I can't seem to find the answer to this in the Elisp doc. Perhaps it's
there, but I've spent a lot of time looking and haven't discovered it. It's
possible I read the answer without recognizing it. I've also looked closely
at several Emacs-Lisp source files, to try to understand better and perhaps
find a model for what I'm trying to do. No luck so far.
How can I look up a menu item that is a submenu in a keymap, and whose key
(or item-string) is a string, not a symbol? That is, how can I pass the
submenu menu-item string to some function and have it return the keymap for
that submenu?
For example, in this Imenu keymap, which is the result of (lookup-key
(current-local-map) [menu-bar index]), how can I look up the "Variables"
keymap:
(keymap "foo.el"
("Variables" "Variables" keymap "Variables"
("toto" "toto" lambda nil
(interactive)
(imenu--menubar-select
'("toto" . #<marker at 37004 in foo.el>)))))
IOW, what would I use to obtain from the Imenu keymap the following submenu
map, given the menu-item string for the submenu, "Variables"?
(keymap "Variables"
("toto" "toto" lambda nil
(interactive)
(imenu--menubar-select
'("toto" . #<marker at 37004 in foo.el>))))
`lookup-key' doesn't seem to help here - at least I cannot just pass
"Variables" as the key arg to it. And passing the symbol `Variables' to it
obviously doesn't work either, since the key in the map itself is a string.
If Variables in the keymap were a key (event) instead of a string, I could
do (lookup-key (current-local-map) [menu-bar index Variables]) or
(lookup-key (lookup-key (current-local-map) [menu-bar index]) 'Variables).
IOW, if the submenu item were like this, there would be no problem:
(Variables "Variables" keymap "Variables"
("toto" "toto" lambda nil
(interactive)
(imenu--menubar-select
'("toto" . #<marker at 37004 in foo.el>))))
But, how do I deal with a string "Variables" as the key (which is the
item-string) here? In other menus, I usually see a symbol as the key for a
submenu, but for Imenu it is always a string.
Please let me know what I'm missing - thanks!
- looking up a submenu keymap in a menu keymap, when the submenu key is a string,
Drew Adams <=
- Re: looking up a submenu keymap in a menu keymap, when the submenu key is a string, Stefan Monnier, 2006/10/08
- RE: looking up a submenu keymap in a menu keymap, when the submenu key is a string, Drew Adams, 2006/10/08
- Re: looking up a submenu keymap in a menu keymap, when the submenu key is a string, Stefan Monnier, 2006/10/09
- RE: looking up a submenu keymap in a menu keymap, when the submenu key is a string, Drew Adams, 2006/10/09
- Re: looking up a submenu keymap in a menu keymap, when the submenu key is a string, Stefan Monnier, 2006/10/09
- RE: looking up a submenu keymap in a menu keymap, when the submenu key is a string, Drew Adams, 2006/10/09