From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: Limit what M-x TAB lists? Date: Thu, 26 Dec 2013 17:09:49 +0100 Message-ID: <877garh9v6.fsf@building.gnus.org> References: <87bo03itkn.fsf@building.gnus.org> <87wqirhbyw.fsf@building.gnus.org> <87mwjn7g75.fsf@wanadoo.es> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1388074570 26002 80.91.229.3 (26 Dec 2013 16:16:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 26 Dec 2013 16:16:10 +0000 (UTC) Cc: emacs-devel@gnu.org To: =?iso-8859-1?Q?=D3scar?= Fuentes Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 26 17:16:17 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VwDbc-00086L-T1 for ged-emacs-devel@m.gmane.org; Thu, 26 Dec 2013 17:16:17 +0100 Original-Received: from localhost ([::1]:46143 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwDbc-00049Q-Dy for ged-emacs-devel@m.gmane.org; Thu, 26 Dec 2013 11:16:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36647) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwDbU-00048H-6q for emacs-devel@gnu.org; Thu, 26 Dec 2013 11:16:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VwDbO-0004w4-M8 for emacs-devel@gnu.org; Thu, 26 Dec 2013 11:16:08 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:47294) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwDbO-0004vy-Fv for emacs-devel@gnu.org; Thu, 26 Dec 2013 11:16:02 -0500 Original-Received: from 2.148.235.122.tmi.telenormobil.no ([2.148.235.122] helo=building.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1VwDb9-0003YT-OZ; Thu, 26 Dec 2013 17:15:47 +0100 In-Reply-To: <87mwjn7g75.fsf@wanadoo.es> (=?iso-8859-1?Q?=22=D3scar?= Fuentes"'s message of "Thu, 26 Dec 2013 17:03:10 +0100") User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux) X-MailScanner-ID: 1VwDb9-0003YT-OZ MailScanner-NULL-Check: 1388679347.91796@vI9LyEHBXoalkDX2WZCCFA X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.224.195 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:166895 Archived-At: =D3scar Fuentes 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") ...) =20=20 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. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/