From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Magne Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: Ordering of command completions Date: Sun, 07 Dec 2014 17:28:12 +0100 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1417969735 8504 80.91.229.3 (7 Dec 2014 16:28:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 7 Dec 2014 16:28:55 +0000 (UTC) Cc: emacs-devel@gnu.org To: Tom Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Dec 07 17:28:49 2014 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 1XxehU-0007VU-F7 for ged-emacs-devel@m.gmane.org; Sun, 07 Dec 2014 17:28:48 +0100 Original-Received: from localhost ([::1]:58399 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxehT-0007UJ-K5 for ged-emacs-devel@m.gmane.org; Sun, 07 Dec 2014 11:28:47 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44993) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxehK-0007U8-V1 for emacs-devel@gnu.org; Sun, 07 Dec 2014 11:28:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XxehE-0007lU-M9 for emacs-devel@gnu.org; Sun, 07 Dec 2014 11:28:38 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:54907) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxehE-0007lL-Az for emacs-devel@gnu.org; Sun, 07 Dec 2014 11:28:32 -0500 Original-Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=stories.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1Xxegu-0005Rc-Sg; Sun, 07 Dec 2014 17:28:12 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEXENgDMPwHKOwDHOQDc fkihKwCkdq3HAAACP0lEQVQ4jVVUwXbiMAxUMb1jV73XSvZupOwdB/UT+v+/siObUFaQPKKxZ6Sx CBFd3voZn60zPt4d0fsP+ebsjMAzfkzUAUR+Bbr2tedci+QqsgLoPV2IkpmR30VYSsE9qAiRcCl7 FvGSIzyA1pA221x4r54P4DZ4SK++i+/rBLi/Uw8qMmLfs+/MQVUCGBrY1bd79c4cG0r1v+TJoqTr sgUPCgAPNP6ACmmTqJ29RhLdc/+k+yBKAC6bZw8gOv8MDROzpCsjy5mHVw6gjbZb2ngaCAcnEEyq pquDaVzR4NCwUfAa7s6+c4iDyhZLi8DzkH5Y8kmcKEFmEc/XZz4/NEyTiueXAHBrp2YqUrvoLzD6 SA1s9HZXKbW8UOE08E0nWPe7g+cOw6YEv575ih19HJ8p7smeKgPAgSdRFUxIedWYowCDzUIm+Irw NzFFg7o0wkRlzEnNtVYAUZWNgZAR/3UeoWbLgRQN4BJtxPEqWscUSgWjf9N2iXqjDc1yROYbNGZR UW4N7bHJP8jHMcWUYiBqLK8oLIAL+mihUAeVxs34TucblreoGKk81osWANhhwYR0WXSUC2N4pz7W Gy6VaBzVQn5qhLjG4tFhRQV1aoQhTRdUPKCMG6jQyvAqaZz8ovIYLPIvnDj8nR6WEFhAVUZVcVRY vzyo4D+ottv8ryXMI+bkYTyoIJ5O2uwEqzofr40OjdzPeDWskfIjgNC+HU9zOe+8Z8wEuZ/Hm+Tc rx8qcJPefyIo3iSnr/nwGv8AUvmW/1dfPqcAAAAASUVORK5CYII= X-Now-Playing: Telebossa's _Telebossa_: "Der falsche Raum" X-Hashcash: 1:23:141207:adatgyujto@gmail.com::G2mSWMP1s5JDu4u5:000000000000000000000000000000000000000005AhU X-Hashcash: 1:23:141207:emacs-devel@gnu.org::cx0Byo0lUxYCb5ne:000000000000000000000000000000000000000001unQQ In-Reply-To: (Tom's message of "Sun, 7 Dec 2014 16:14:37 +0000 (UTC)") User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) X-MailScanner-ID: 1Xxegu-0005Rc-Sg MailScanner-NULL-Check: 1418574493.4917@1wSYqDwlVJ7E6sER8IHAwg 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:179271 Archived-At: Tom writes: > Just a quick thought: various modes have lots of keybindings and > often I use M-x to invoke commands of unfamiliar or rarely used > modes, because I don't always know the relevant keybindings. Of > course, I can use the prefix of the mode when completing, but I > may not know it and it may not be obvious depending on the > mode. It occured to me that M-x, when showing completions, could > list command matches from the current major mode first, then from > the minor modes and then the rest of the commands. By looking at the commands bound in the active keymaps? Yes, that would help. We discussed the opposite problem a while ago -- excluding commands that only make sense in a specific mode from turning up when doing command completion. For instance, if you're in the *scratch* buffer, you never want the `message-send-and-exit' command. During the last discussion, we touched on introducing a new form that would explicitly say what mode a commands belongs to. (Some commands are applicable generally; most are related to a specific mode.) So something like (defun message-send-and-exit () "Doc string." (command message-mode "P") ...) where `command' is just like `interactive', only that it takes a mode name (or a list of mode names) that says "where it belongs". The main problem with that approach is that it wouldn't really work for out-of-tree packages, since introducing something like that requires Emacs Lisp engine level changes, I think. But if we had this mechanism, then `M-x m' would only complete to things that are potentially useful in the current buffer (or globally), which would be very nice. Other, less intrusive approaches (that is, that could be used out of tree by including legacy macros) would be (defcommand message-send-and-exit () "Doc string." (command message-mode "P") ...) where out-of-tree `defcommand' would be a macro that just transforms `command' into `interactive'. Or even more ugly, but even less intrusive for out-of-tree use, by using a special comment cookie that would just the appropriate modes: ;;;##!message-mode (defun message-send-and-exit () "Doc string." (interactive "P") ...) And probably other approaches... -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no