[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Limit what M-x TAB lists?
From: |
Lars Ingebrigtsen |
Subject: |
Re: Limit what M-x TAB lists? |
Date: |
Thu, 26 Dec 2013 17:09:49 +0100 |
User-agent: |
Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux) |
Óscar Fuentes <address@hidden> writes:
> Instead of a predicate for every function, the usual Emacs idiom of "if
> it is a symbol, filter by mode, if it is a function, it must be a
> predicate returning non-nil if the command is applicable blah blah...".
> I'll bet that 99% of the commands fall in the "symbol" case, which is
> fast.
Yup. But perhaps the symbols we want to use here are really mode names?
And mode names are unfortunately also functions... Hm...
> I'm definitely interested on this idea. It is annoying (as in "Emacs
> looks stupid and counterproductive") to always see useless candidates on
> M-x. If you put the underlying machinery in place, I volunteer for the
> command hunt.
Great!
> It would be nice if the annotations were backwards compatible, so they
> could be added to external packages without making them incompatible
> with past Emacs releases.
Well, if we go with new variations on `interactive', then external
packages could just do something like
(unless (fboundp 'command)
(defmacro command (&rest args)
`(interactive ,@(cdr args))))
and then
(defun vc-dir-mark ()
(command 'vc-dir-mode "p")
...)
(defun quit-window ()
(command (lambda () (..stuff..)) "p")
...)
Or something. Would that work, or is `interactive' interpreted even
more specially? (I.e., before macro expansion...) Let's see...
(defun foo (arg)
(command 'bar "p")
(message "%s" arg))
Yup, seems to work.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
Re: Limit what M-x TAB lists?, Tom, 2013/12/26
Limit what M-x TAB lists?, Stephen J. Turnbull, 2013/12/27