all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Scott Frazer <frazer.scott@gmail.com>
To: emacs-devel@gnu.org
Subject: Per-mode obarray for M-x
Date: Sun, 6 Mar 2011 08:04:42 -0500	[thread overview]
Message-ID: <AANLkTi=sb=BCeYupOW265NDSkDz1VThj8KHA00C21xBv@mail.gmail.com> (raw)

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	other threads:[~2011-03-06 13:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-06 13:04 Scott Frazer [this message]
2011-03-06 13:29 ` Per-mode obarray for M-x Eli Zaretskii
2011-03-06 15:56   ` Scott Frazer
2011-03-06 18:43     ` Thierry Volpiatto
2011-03-06 13:39 ` David Engster
2011-03-06 20:04 ` Stefan Monnier
2011-03-08  0:39 ` Richard Stallman
2011-03-08  3:08   ` Stefan Monnier
2011-03-09  0:40     ` Richard Stallman
2011-03-09  3:26       ` Stefan Monnier
2011-03-09 23:02         ` Richard Stallman
2011-03-09 14:33   ` Scott Frazer
2011-03-09 16:08     ` Davis Herring
2011-03-10 23:15     ` Richard Stallman
2011-03-11  2:18     ` Scott Frazer
2011-03-11 14:57       ` Ted Zlatanov
2011-03-11 18:21         ` Scott Frazer
2011-03-11 19:02           ` Ted Zlatanov

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

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

  git send-email \
    --in-reply-to='AANLkTi=sb=BCeYupOW265NDSkDz1VThj8KHA00C21xBv@mail.gmail.com' \
    --to=frazer.scott@gmail.com \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.