From: David Engster <deng@randomsample.de>
To: emacs-devel@gnu.org
Subject: Re: Per-mode obarray for M-x
Date: Sun, 06 Mar 2011 14:39:28 +0100 [thread overview]
Message-ID: <878vwsbc6n.fsf@engster.org> (raw)
In-Reply-To: <AANLkTi=sb=BCeYupOW265NDSkDz1VThj8KHA00C21xBv@mail.gmail.com> (Scott Frazer's message of "Sun, 6 Mar 2011 08:04:42 -0500")
Scott Frazer writes:
> 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.
This is not exactly what you're looking for, but take a look at the
mode-local package which now ships with Emacs. It's in the lisp/cedet
directory and lets you define variables and functions dependent on the
major-mode.
In a nutshell:
(define-overloadable-function somefunc (params)
"doc-string")
(defun somefunc-default (params)
"doc-string"
... default behavior ...)
(define-mode-local-override somefunc org-mode (params)
"doc-string"
... behavior for org-mode ...)
-David
next prev parent reply other threads:[~2011-03-06 13:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-06 13:04 Per-mode obarray for M-x Scott Frazer
2011-03-06 13:29 ` Eli Zaretskii
2011-03-06 15:56 ` Scott Frazer
2011-03-06 18:43 ` Thierry Volpiatto
2011-03-06 13:39 ` David Engster [this message]
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=878vwsbc6n.fsf@engster.org \
--to=deng@randomsample.de \
--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.