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: Limit what M-x TAB lists? Date: Thu, 26 Dec 2013 15:18:48 +0100 Organization: Programmerer Ingebrigtsen Message-ID: <87bo03itkn.fsf@building.gnus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1388067973 24701 80.91.229.3 (26 Dec 2013 14:26:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 26 Dec 2013 14:26:13 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 26 15:26:20 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 1VwBsn-00063g-9J for ged-emacs-devel@m.gmane.org; Thu, 26 Dec 2013 15:25:53 +0100 Original-Received: from localhost ([::1]:45841 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwBsm-0006cL-Kn for ged-emacs-devel@m.gmane.org; Thu, 26 Dec 2013 09:25:52 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwBsV-0006Oj-Sq for emacs-devel@gnu.org; Thu, 26 Dec 2013 09:25:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VwBsP-0004vo-Dl for emacs-devel@gnu.org; Thu, 26 Dec 2013 09:25:35 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:33327) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwBsP-0004ui-73 for emacs-devel@gnu.org; Thu, 26 Dec 2013 09:25:29 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VwBs4-0005Kl-G9 for emacs-devel@gnu.org; Thu, 26 Dec 2013 15:25:08 +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 ; Thu, 26 Dec 2013 15:25:08 +0100 Original-Received: from larsi by 2.148.235.122.tmi.telenormobil.no with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 26 Dec 2013 15:25:08 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 69 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:CFMaTfNSRYCt3AaUOY2N79DxJRA= 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:166891 Archived-At: Here's today's unrealistic idea: Wouldn't it be nice if `M-x fooTAB' was more useful? For instance, if I type `M-x vc-dTAB' in this buffer, I get the following: Possible completions are: vc-default-check-headers vc-default-mark-resolved vc-default-revision-completion-table vc-delete-file vc-diff vc-dir vc-dir-delete-file vc-dir-find-file vc-dir-find-file-other-window vc-dir-hide-state vc-dir-hide-up-to-date vc-dir-ignore vc-dir-isearch vc-dir-isearch-regexp vc-dir-kill-dir-status-process vc-dir-kill-line vc-dir-mark vc-dir-mark-all-files vc-dir-menu vc-dir-mode vc-dir-next-directory vc-dir-next-line vc-dir-previous-directory vc-dir-previous-line vc-dir-query-replace-regexp vc-dir-refresh vc-dir-search vc-dir-show-fileentry vc-dir-toggle-mark vc-dir-unmark vc-dir-unmark-all-files vc-dir-unmark-file-up Out of all this, I think there's two actual commands I can use here -- the rest are just commands bound to keystrokes in VC mode. It would be really nice for discoverability if only those two applicable commands were listed. And it doesn't really seem unachievable. There's oodles of ways of achieving this that would require more or less work. 1) Just make M-x list ;;;###autoloaded functions. That would require us adding those cookies to more functions, though. 2) New form like (command-interactive 'vc-mode "p") This would say "this command is only valid in VC mode buffers", so it would not be listed by M-x in other modes. This would be pretty flexible, but would be a lot of code churn. But it wouldn't require a global Armageddon date, but one could add this at leisure, and M-x would gradually become nicer. 3) New form like (global-interactive "p") Kinda like the opposite of 2), but here we mark commands as being global. It would be less churn, but be more Armageddon-ey. Unless we add cookies per file that says that "this file is now new-style". Kinda like (pragma (local-interactive 'vc-mode)) at the start or something. The added bonus of both 2) and 3) might be that commands would refuse to run unless called in the right mode buffers. Which might mean fewer bug reports down the line. There's a bunch of commands (like `quit-window') that apply to many (special) modes, but we could figure something out for those, too... (Oops. I almost ran `M-x quit-window' in this buffer. I wonder what would have happened...) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/