[Top][All Lists]

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

Re: Per-mode obarray for M-x

From: David Engster
Subject: Re: Per-mode obarray for M-x
Date: Sun, 06 Mar 2011 14:39:28 +0100
User-agent: Gnus/5.110014 (No Gnus v0.14) Emacs/23.2 (gnu/linux)

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

In a nutshell:

(define-overloadable-function somefunc (params)

(defun somefunc-default (params)
 ... default behavior ...)

(define-mode-local-override somefunc org-mode (params)
 ... behavior for org-mode ...)


reply via email to

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