From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Jose A. Ortega Ruiz" Newsgroups: gmane.emacs.devel Subject: Re: Smarter M-x that filters on major-mode Date: Thu, 11 Feb 2021 22:22:21 +0000 Message-ID: <87pn16mehu.fsf@gnus.jao.io> References: <8ed9b43502ae1480e06b@heytings.org> <83r1lohqoc.fsf@gnu.org> <87wnvfenry.fsf@gnus.org> <87blcrdlqf.fsf@gnus.org> <87v9aydg3f.fsf@gnus.org> <83y2fuheph.fsf@gnu.org> <87im6yd4sz.fsf@gnus.org> <8735y2y44f.fsf@gnus.org> <87mtwajua4.fsf@telefonica.net> <87eehmwfeg.fsf@gnus.org> <87blcqjq45.fsf@telefonica.net> <875z2ywbvm.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15560"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: emacs-devel@gnu.org Cancel-Lock: sha1:aGGminRXP0D57KkotaTuFlEIpOc= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Feb 12 00:09:57 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lAL5w-0003y6-I2 for ged-emacs-devel@m.gmane-mx.org; Fri, 12 Feb 2021 00:09:56 +0100 Original-Received: from localhost ([::1]:35216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAL5v-0006jM-5U for ged-emacs-devel@m.gmane-mx.org; Thu, 11 Feb 2021 18:09:55 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAL4H-0005tv-08 for emacs-devel@gnu.org; Thu, 11 Feb 2021 18:08:13 -0500 Original-Received: from ciao.gmane.io ([116.202.254.214]:46632) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAL4E-0000hw-B1 for emacs-devel@gnu.org; Thu, 11 Feb 2021 18:08:11 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1lAL4A-0001zS-0u for emacs-devel@gnu.org; Fri, 12 Feb 2021 00:08:06 +0100 X-Injected-Via-Gmane: http://gmane.org/ X-Attribution: jao X-Clacks-Overhead: GNU Terry Pratchett X-URL: Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:264450 Archived-At: On Thu, Feb 11 2021, Lars Ingebrigtsen wrote: > We now have > > (defun foo2 (arg) > (command c-mode "p") > (message "%s 2" arg)) You probably have already thought of it, and discarded it for a good reason, but why not, instead of a new `command' form, just add a new (optional) argument to `interactive'? (defun foo2 (arg) (interactive "p" c-mode) (message "%s 2" arg)) it could even accept more than one mode (defun foo2 (arg) (interactive "p" text-mode json-mode) (message "%s 2" arg)) and for users it'd be arguably easier to recognize what it means at a glance (since we all know about `interactive'). i could even imagine a top level declaration like, say, `(default-interactive-mode my-mode)' which would supply to all commands in that .el that value for the optional arg (to easyly update packages that define a mode and mostly commands just for it, something i at least do very often), adding just a line to the file. or it could be a local variable and work a bit like lexical-binding... ;;; my-mode.el --- a very useful mode -*- interactive-mode: my-mode -*-