M-x in Lisp
Aaron S. Hawley <aaron.s.hawley <at> gmail.com>
2012-03-21 13:49:25 GMT
M-x or `execute-extended-command' is a C primitive. Here's a Lisp
version that works *only* in the Emacs 24 pretest. I've purposely
cargo culted the original C version, including carrying over the
comments. I've been using using and maintaining this code since 2008
and haven't had any issues. After 24.1 is released (any day now), I'm
hoping to contribute it back so it can be included in a future release
of Emacs (24.2, 25.1?). Send me comments off-list if you come across
any issues with using it.
Install by putting the following snippet in your .emacs, and putting
the library m-x.el (attached) in your load-path.
(unless (fboundp 'primitive-execute-extended-command)
(defalias 'execute-extended-command 'ash-execute-extended-command)
(autoload 'ash-execute-extended-command "m-x"
"Read function name, then read its arguments and call it.
gnu-emacs-sources mailing list
gnu-emacs-sources <at> gnu.org