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: Leaving out non-applicable commands on Mx Date: Sat, 09 Jan 2016 09:06:08 +0100 Message-ID: References: <87mvszdp6b.fsf@gnus.org> <8737u9kv6f.fsf@russet.org.uk> <87fuy7hdc6.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 1452326823 20900 80.91.229.3 (9 Jan 2016 08:07:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 Jan 2016 08:07:03 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 09 09:06:53 2016 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 1aHoY1-0007EX-Hy for ged-emacs-devel@m.gmane.org; Sat, 09 Jan 2016 09:06:53 +0100 Original-Received: from localhost ([::1]:39559 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHoY0-0007NX-HF for ged-emacs-devel@m.gmane.org; Sat, 09 Jan 2016 03:06:52 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40302) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHoXo-0007NO-SP for emacs-devel@gnu.org; Sat, 09 Jan 2016 03:06:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aHoXl-00072D-MC for emacs-devel@gnu.org; Sat, 09 Jan 2016 03:06:40 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:42665) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHoXl-0006z9-F9 for emacs-devel@gnu.org; Sat, 09 Jan 2016 03:06:37 -0500 Original-Received: from cm-84.215.1.64.getinternet.no ([84.215.1.64] helo=stories) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aHoXI-0007AR-H8 for emacs-devel@gnu.org; Sat, 09 Jan 2016 09:06:08 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEWmjXgTCwwDAQKTdmFJ Myyaf2iCZFLKHua9AAACYklEQVQ4jU2UwXKjMAyGtdPAGTlu7/YmPbPjwjlOtT57h5gzKcTv/wgr GWjDcIm+6P8lIRtyds51KUGVUgUdAFT8a0gwz7Obd1AlAUkeyC4XkOcUq9gygMhhAUVqXPLc5ylw PMEQQaRWgJqIOh3oUYQGkASXqg8MC1HyXj8iW8dUANdws0Sohzvio7gDrBbp5sOCb+GPtRODoYub VLpp8vh6XwSs5e4AkfDzStZ2UeJbRicAH2lR1rCuvKtHrD6MDoOjqzVFKLkNvCw2BMp0RS0tikcv oKoXa4w35DXBSgSw5MjlWINkBVQMBgaDjJltrfYMQoQqCpBaU3rJyIBI6dCuk19BNxJnBKKrztMT cIuXhK6nq6FHAUVqJHFgpSAgwJBLg8Al+V/2/V1PcKB3onqSesG1CUYP9tyEOvfHBrFONAngLz36 5evcXHL2x8aaus3FnJcm+a/l97khb4+vqA/SilQFVYtf57/N59UKoJraAjoG9M/CJR/wdnxbHi8y rQpk5qQ9zyKHXp3UBbZHGlcGgzfITVr7FjfAE0yePxzvCM8cbbNn8BKlu0FrPPLOWXt5AjUrICoZ yw5ikRolYDiOHpUMN1ZMdrA/z1WNBn/A9A1cNxh3J7WBFjYTWR/seQ23rL0NkONheAtKAYgGfqSc U3pZExhsGWWpswrc3Wpiuh+pPiuOmyJlT10VdykG+/8tgxQ3qd5lz4dGfQMOykhcP7uciTx+g3VW fC/kLGRtcQPFXOKZzzJ/cmVPfEHE9Qz2TwDVaY7bXcIeedXyvKUY5vWoJZFyOzBEge+Wjpsc/gOk ZdkroSIWEQAAAABJRU5ErkJggg== In-Reply-To: (John Wiegley's message of "Fri, 08 Jan 2016 16:22:37 -0800") User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.1.50 (gnu/linux) X-MailScanner-ID: 1aHoXI-0007AR-H8 MailScanner-NULL-Check: 1452931569.0778@iDUsKJhmUD8KnvzScWhw0Q 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:197889 Archived-At: John Wiegley writes: >>>>>> =D3scar Fuentes writes: > >>> We've discussed before adding mechanisms for leaving mode-specific comm= ands >>> out, but I was apparently the only one enthusiastic about it... > >> You sketched a possible implementation. If you are interested on complet= ing >> the part that requires a smart hacker, I'll do the part that requires a = dumb >> one :-) > > What is this feature suggestion again? Marking commands as applicable to a mode (or a set of modes) so that completion doesn't list them outside of those modes. This requires instrumentation of all interactive commands. :-) But for virtually all modes, it's just a search and replace action. =D3scar mentioned one syntax suggestion for this: (defun foo-something (bar) "docstring" (interactive "p") (declare (mode foo)) ...) This would be backwards compatible. The other one is to introduce a new form `command': (defun foo-something (bar) "docstring" (command 'foo "p") ...) where the first element is a mode name, or a list of mode names, where the command applies. So, three things need to be done: 1) Decide what syntax we want for this (and implement it in Emacs), 2) Alter `M-x' to react to this new data (which will probably be something in the symbol list, I guess?) to complete only over commands that are either available globally, or in the current local mode(s). and then people can calmly 3) Convert all packages in Emacs (mostly with a replace-string) to use the new syntax, and `M-x' will slowly grow better and better as a tool to discover commands. I favour the `command' solution. It looks cleaner as a language element, especially since virtually (well beyond 90%) every command in Emacs will have one of these. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no