emacs-devel
[Top][All Lists]
Advanced

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

Per-mode obarray for M-x


From: Scott Frazer
Subject: Per-mode obarray for M-x
Date: Sun, 6 Mar 2011 08:04:42 -0500

How hard would it be to make a per-mode obarray for M-x?  Sort of like
the per-mode keymap and abbrev tables, I'd like to do "M-x command"
and have it act differently depending on the mode; e.g. "M-x html" in
a org-mode buffer would run org-export-as-html, but the 'default'
action in other buffers would be to run, say, htmlize-buffer.

Here's why I'd like this.  There are some commands I run somewhat
often, but they have long and/or difficult to remember names.  For
example auto-revert-tail-mode.  I am thinking as I type "Is it
auto-revert-tail-mode or auto-tail-revert-mode?"  I don't do it often
enough to take up a valuable short key binding like "C-c t", and long
key bindings can be just as difficult to remember.  Even with
minibuffer completion it interrupts my workflow, so I do "(defalias
'auto-revert-tail-mode 'tail)" and it becomes just "M-x tail".  That's
fine in this case, but you can see how I'm going to quickly run into
problems since there is only one namespace.

I understand this would be a huge undertaking if I wanted this to work
in general elisp code, which is why prefixes are used in function
names to create namespaces.  But I just want it to work with M-x.

I am willing to dig around and make a patch myself, but I'd like
someone familiar with the internals to (a) tell me if it's extremely
difficult and/or a bad idea, and if not (b) point me in the right
direction.

Regards,
Scott



reply via email to

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