From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Limit what M-x TAB lists? Date: Thu, 26 Dec 2013 09:58:25 -0500 Message-ID: References: <87bo03itkn.fsf@building.gnus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1388069925 12044 80.91.229.3 (26 Dec 2013 14:58:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 26 Dec 2013 14:58:45 +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:58:51 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 1VwCOc-0007wn-4R for ged-emacs-devel@m.gmane.org; Thu, 26 Dec 2013 15:58:46 +0100 Original-Received: from localhost ([::1]:45931 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwCOb-0001WB-OW for ged-emacs-devel@m.gmane.org; Thu, 26 Dec 2013 09:58:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52463) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwCOS-0001W5-9g for emacs-devel@gnu.org; Thu, 26 Dec 2013 09:58:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VwCOL-0006Os-0L for emacs-devel@gnu.org; Thu, 26 Dec 2013 09:58:36 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:45895) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwCOK-0006Nx-RK for emacs-devel@gnu.org; Thu, 26 Dec 2013 09:58:28 -0500 Original-Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id rBQEwPnt010040; Thu, 26 Dec 2013 09:58:26 -0500 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 17C57AE267; Thu, 26 Dec 2013 09:58:25 -0500 (EST) In-Reply-To: <87bo03itkn.fsf@building.gnus.org> (Lars Ingebrigtsen's message of "Thu, 26 Dec 2013 15:18:48 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4803=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4803> : inlines <359> : streams <1097339> : uri <1635605> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 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:166892 Archived-At: > Here's today's unrealistic idea: Wouldn't it be nice if `M-x fooTAB' was > more useful? Yes. I rewrote M-x in Elisp, partly to try and make it easier for people to try and tweak it. > 2) New form like (command-interactive 'vc-mode "p") More generally, move the "sanity checks" performed at the beginning of some commands to a special place so they can be run without actually calling the function. IOW add a "callable" predicate alongside the interactive-spec that M-x could then use to filter out inapplicable commands. Of course, this will require many changes in many packages before it becomes really useful. > 1) Just make M-x list ;;;###autoloaded functions. > That would require us adding those cookies to more functions, though. Not good enough. Many commands are very useful via M-x but only after loading a particular mode (those commands only make sense in that mode, of course). Maybe a related approach is to use a fancier analysis that tries to figure out "would this command always be available in this context?" (as opposed to being available because of some unrelated buffer having caused some packages to be loaded). Other ways we could try and improve M-x: - Move to the beginning of the list, those commands that start with the same prefix as the current major mode. - Move to the end of the list those commands that are accessible via a key-binding (and the shorter the key-binding, the further towards the end). Stefan