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: Stefan Monnier
Subject: Re: Per-mode obarray for M-x
Date: Sun, 06 Mar 2011 15:04:16 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> 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.

I don't think you really want separate obarrays for this, you can just
use lists of symbols.  But you'd want mode-local abbreviations, maybe,
or mode-local preferred commands, so TAB first tries one of those and
only if those fail does it fallback to the full set of commands.
There was also a suggestion to give easier access to commands from "the
same mode/package", so M-x context->unified RET in a diff-mode buffer
would run diff-context->unified.

That would not be too difficult to do on the M-x side: the main
2 difficulties are:
- how to populate this list/set of mode-local commands.
- add the corresponding functionality to execute-extended-command, which
  would better be done by first re-writing it in Elisp.
Rewriting execute-extended-command in Elisp would make it a lot easier
to play around with such things.
  

        Stefan



reply via email to

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