unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Emacs-Devel <emacs-devel@gnu.org>
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	[thread overview]
Message-ID: <jwv3b9yozcs.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <EIENLHALHGIMHGDOLMIMGEMMCLAA.drew.adams@oracle.com> (Drew Adams's message of "Sun\, 8 Oct 2006 18\:27\:36 -0700")

>     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	other threads:[~2006-10-09  5:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-08 18:34 looking up a submenu keymap in a menu keymap, when the submenu key is a string Drew Adams
2006-10-09  1:02 ` Stefan Monnier
2006-10-09  1:27   ` Drew Adams
2006-10-09  5:07     ` Stefan Monnier [this message]
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv3b9yozcs.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).