emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: looking up a submenu keymap in a menu keymap, when the submenu key i


From: Stefan Monnier
Subject: Re: looking up a submenu keymap in a menu keymap, when the submenu key is a string
Date: Mon, 09 Oct 2006 01:07:30 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>     You can try to pass ["Variables"].  But it's really not that
>     simple, since
>     you have to distinguish between the menu name and the "pseudo-key"
>     associated with it.  In your examples, both are strings and
>     they are equal,
>     but that's not necessarily the case.
>     You may want o check the easy-menu functions for that, tho they're not
>     always as "easy" to use as the name implies.

> Right. Thanks for your reply. I did try ["Variables"] (and [menu-bar index
> "Variables"]),

This can work, but the test is `eq' rather than `equal' so you have to pass
not just some random "Variables" string, but the very one used in the keymap.

> and I did study the easy-menu stuff.  The easy-menu stuff almost seemed as
> if it was going to get me what I needed, but I wasn't able to make it
> work.  Other suggestions are welcome, from anyone.

I think easy-menu is the way to go.  Tell us what you tried.
Of course, it may also be important to know the context in which you're
doing that: maybe there's a simpler way.

> If there is no easy (or even feasible) way to do this, I wonder if it isn't
> a mistake to "allow", or at least encourage, this kind of keymap entry -
> Imenu is a standard library.

It's definitely not encouraged, but it should mostly be irrelevant, because
it's an internal issue.  Normally, either you have the key already (from
read-key-sequence, for example), or you have the menu entry name (in which
case you have to use code such as the one used in easy-menu to scan the
keymap and recover the corresponding key).


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]