From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: jao Newsgroups: gmane.emacs.devel Subject: Re: Smarter M-x that filters on major-mode Date: Fri, 12 Feb 2021 16:18:48 +0000 Message-ID: <87a6s9mf87.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> <87pn16mehu.fsf@gnus.jao.io> <87o8gpvdfd.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="40073"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: "Lars Ingebrigtsen" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Feb 12 17:21:43 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 1lAbCQ-000AKp-Ny for ged-emacs-devel@m.gmane-mx.org; Fri, 12 Feb 2021 17:21:42 +0100 Original-Received: from localhost ([::1]:51948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAbCO-00054U-Uq for ged-emacs-devel@m.gmane-mx.org; Fri, 12 Feb 2021 11:21:41 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAbAC-0002vi-7V for emacs-devel@gnu.org; Fri, 12 Feb 2021 11:19:24 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:53272) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAbAB-00023K-Sm; Fri, 12 Feb 2021 11:19:23 -0500 Original-Received: from [85.159.237.73] (port=33846 helo=osgiliath.local) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1lAbA9-0001wL-T7; Fri, 12 Feb 2021 11:19:22 -0500 Original-Received: by osgiliath.local (Postfix, from userid 1000) id A9F8D40326; Fri, 12 Feb 2021 16:18:48 +0000 (GMT) In-Reply-To: <87o8gpvdfd.fsf@gnus.org> (Lars Ingebrigtsen's message of "Fri, 12 Feb 2021 10:32:54 +0100") X-Attribution: jao X-Clacks-Overhead: GNU Terry Pratchett X-URL: 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:264523 Archived-At: On Fri, Feb 12 2021, Lars Ingebrigtsen wrote: > "Jose A. Ortega Ruiz" writes: > >> 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)) > > The argument to `interactive' is optional, so it'd be > > (defun foo2 () > (interactive nil c-mode) > > in most of the cases, which seemed less than ideal. But on the other > hand, not introducing a new keyword would perhaps help with reading > comprehension. it's perhaps more tricky, but it could also be (interactive 'c-mode) which is distinguisable from a string or a form: (interactive "p") (interactive (list a b)) i.e., one adopts the convention that if the argument's value is a symbol, it denotes a mode. personally, i would like that option even better, but i'd understand people might consider it a bit brittle.