From: "Drew Adams" <drew.adams@oracle.com>
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 [thread overview]
Message-ID: <MEEKKIABFKKDFJMPIOEBMEHLDFAA.drew.adams@oracle.com> (raw)
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!
next reply other threads:[~2006-10-08 18:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-08 18:34 Drew Adams [this message]
2006-10-09 1:02 ` looking up a submenu keymap in a menu keymap, when the submenu key is a string Stefan Monnier
2006-10-09 1:27 ` Drew Adams
2006-10-09 5:07 ` Stefan Monnier
2006-10-09 15:36 ` Drew Adams
2006-10-09 16:57 ` Stefan Monnier
2006-10-10 1:31 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MEEKKIABFKKDFJMPIOEBMEHLDFAA.drew.adams@oracle.com \
--to=drew.adams@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.