[Top][All Lists]

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

Re: C-l while in menu?

From: Kim F. Storm
Subject: Re: C-l while in menu?
Date: 23 Apr 2002 14:06:02 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50

Miles Bader <address@hidden> writes:

> Ben Wing <address@hidden> writes:
> > the fact is that things work quite well when you have only a meta key.
> > e.g. meta+letter is an accelerator only when such a menu exists;
> > otherwise, you get the regular binding -- and even then you can
> > retrieve the shadowed binding with shift+meta+letter.
> Do people really like this?  It sounds astonishly annoying to have
> random meta keys stolen by the menus, especially since emacs has many
> useful and common commands on M-letter keys.  E.g., doesn't the `File'
> menu steal `M-f', the `Buffers' menu `M-b', etc.?
> I am skeptical ...

So am I.

I rarely use the menus, so I definitely don't want any accellerator
keys to steal *ANY* of the M- key bindings which are hardwired into my
spine after +15 years of emacs usage...

On the other hand, I think many new users would expect that M-f would
open the File menu, and since he doesn't already know that M-f runs
forward-word, he'll probably never be bothered with having to use S-M-f
to invoke that command.

Personally, I wouldn't mind if I could use S-M-f to open the File menu
- but if I'm in message mode, I'd much rather prefer if it opened the
Field menu...

So, what's the right approach here?

Well, at least make the accellerator modifier(s) configurable!!!

Default could be 'meta or 'alt or '(shift meta) or nil -- depending
on whether we want to help new users (annoying old-timers), or vice versa.

BTW, I think most of this logic be implemented in lisp if we
just had two built-in functions like

  (menu-bar-item-matching-p key) -> returns t if menu starting with KEY exists
  (open-menu-bar-item-matching key) -> opens that menu.

Then, in a menu-accell minor mode, we could have code and bindings like

  (defun menu-accell-check-item ()
    (menu-bar-item-matching-p (this-command-key))

  (defun menu-accell-open-item ()
    (open-menu-bar-item-matching (this-command-key)))

  (defcustom menu-accell-modifiers '(meta))

  ... for KEY in ?a to ?z do ...
  (define-key menu-accell-map 
    (vector (append menu-accell-modifiers (list key)))  ;; eg M-f
    '(menu-item "accell" menu-accell-open-item 
                :filter menu-accell-check-item))

If we want another accellerator modifier, simply clear the menu-accell-map
and rebuild it using the new accellerator modifier.  This can be done
automatically in the :set action of menu-accell-modifiers.

Just an idea...

Kim F. Storm <address@hidden> http://www.cua.dk

reply via email to

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