all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: "Óscar Fuentes" <ofv@wanadoo.es>
Cc: emacs-devel@gnu.org
Subject: Re: Limit what M-x TAB lists?
Date: Thu, 26 Dec 2013 17:09:49 +0100	[thread overview]
Message-ID: <877garh9v6.fsf@building.gnus.org> (raw)
In-Reply-To: <87mwjn7g75.fsf@wanadoo.es> ("Óscar Fuentes"'s message of "Thu, 26 Dec 2013 17:03:10 +0100")

Óscar Fuentes <ofv@wanadoo.es> 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/



  reply	other threads:[~2013-12-26 16:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-26 14:18 Limit what M-x TAB lists? Lars Ingebrigtsen
2013-12-26 14:58 ` Stefan Monnier
2013-12-26 15:24   ` Lars Ingebrigtsen
2013-12-26 16:03     ` Óscar Fuentes
2013-12-26 16:09       ` Lars Ingebrigtsen [this message]
2013-12-26 17:50         ` Stefan Monnier
2013-12-26 18:03           ` Lars Ingebrigtsen
2013-12-27  1:41             ` Lars Ingebrigtsen
2014-01-03 18:00               ` Ted Zlatanov
2014-01-06 15:47             ` Davis Herring
2014-01-18 17:43               ` Lars Ingebrigtsen
2013-12-26 17:50 ` Tom
2014-01-11 21:07   ` Nix
2014-01-11 23:38     ` Drew Adams
2013-12-27  7:29 ` Stephen J. Turnbull

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=877garh9v6.fsf@building.gnus.org \
    --to=larsi@gnus.org \
    --cc=emacs-devel@gnu.org \
    --cc=ofv@wanadoo.es \
    /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.