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: Fri, 27 Dec 2013 02:41:58 +0100 Organization: Programmerer Ingebrigtsen Message-ID: <87zjnn9ijd.fsf@building.gnus.org> References: <87bo03itkn.fsf@building.gnus.org> <87wqirhbyw.fsf@building.gnus.org> <87mwjn7g75.fsf@wanadoo.es> <877garh9v6.fsf@building.gnus.org> <87sitfcww4.fsf@building.gnus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1388108898 5637 80.91.229.3 (27 Dec 2013 01:48:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Dec 2013 01:48:18 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 27 02:48:25 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 1VwMXH-00066P-95 for ged-emacs-devel@m.gmane.org; Fri, 27 Dec 2013 02:48:23 +0100 Original-Received: from localhost ([::1]:47607 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwMXG-0002jA-Pp for ged-emacs-devel@m.gmane.org; Thu, 26 Dec 2013 20:48:22 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwMX8-0002iz-Cq for emacs-devel@gnu.org; Thu, 26 Dec 2013 20:48:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VwMX2-0000xs-7x for emacs-devel@gnu.org; Thu, 26 Dec 2013 20:48:14 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:33536) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwMX2-0000xo-1X for emacs-devel@gnu.org; Thu, 26 Dec 2013 20:48:08 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VwMX0-00062b-SY for emacs-devel@gnu.org; Fri, 27 Dec 2013 02:48:06 +0100 Original-Received: from 2.148.235.122.tmi.telenormobil.no ([2.148.235.122]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 27 Dec 2013 02:48:06 +0100 Original-Received: from larsi by 2.148.235.122.tmi.telenormobil.no with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 27 Dec 2013 02:48:06 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 28 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 2.148.235.122.tmi.telenormobil.no Mail-Copies-To: never User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:EvTKyf5hsFD/lWZeBIIatiMWfII= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:166908 Archived-At: Here's another tweak: We have (interactive) specs like before, and all those are listed in M-x. We add a new (command) spec, and those should be used only for commands used in modes, like previously discussed. Here's the tweak: Instead of adding a predicate, we just use the same syntax as `interactive', i.e., (command "p") or whatever. `M-x TAB' will then list all `interactive' functions, plus all `command' functions that are reachable in current keymaps. So if we're in a vc-dir-mode buffer, `M-x vc-dTAB' will list `vc-dir-mark', but otherwise not. This has the advantage that 1) it's probably easier to implement, and 2) commands that are available via text-property/overlay keymaps, as well as minor modes, all do the right thing without any special handling. And commands like `quit-window' would also "just work", even though it "belongs" in a lot of different modes. This is a 97% solution -- I think it almost gets us to where we want to be. But there are a handful of commands that are deliberately left out of keymaps, but may still only be called in certain modes. For these, we could have another form that does include the previously discussed predicate. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/