emacs-devel
[Top][All Lists]
Advanced

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

Re: Per-mode obarray for M-x


From: Scott Frazer
Subject: Re: Per-mode obarray for M-x
Date: Wed, 9 Mar 2011 09:33:21 -0500

On Mon, Mar 7, 2011 at 7:39 PM, Richard Stallman <address@hidden> wrote:
> The idea of M-x is to run a command by name.
> It is undesirable for modes to be able to interfere with that.
> We have plenty of ways to invoke commands  that depend
> on the major mode, so this one should remain mode-independent.
>

I know of two ways to invoke commands that are mode-specific: keymaps
and menus.  Are there more?

What I want could theoretically be done with menus, but would require
a common menu with items that could be dynamically added/removed or
their function calls changed when changing major modes (or buffers).
I don't think this would be worth the effort.

Keymaps act the way I like: the same key binding in different modes
calls a mode-specific version of some function.  'C-M-a' calls
'beginning-of-defun' in emacs-lisp mode, and calls
'c-beginning-of-defun' in c-mode.  The idea is that I could do "M-x
bod" and it would call the right version.  Of course it would make no
sense for this particular case, but in general instead of making long,
hard to remember key bindings for less frequently used commands you
could use M-x with an easier to remember mnemonic.

There doesn't seem to be much enthusiasm for the idea, so instead of
something integrated I'll just make a package to scratch my own itch.
A couple good suggestions have been made that I can build off of.
Some sort of alist mapping modes to functions with a macro to
define/add things, then add a common function to be called.

Scott



reply via email to

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