From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Smarter M-x that filters on major-mode Date: Fri, 12 Feb 2021 12:36:23 -0500 Message-ID: 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> <87a6s9mf87.fsf@gnus.jao.io> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39544"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Lars Ingebrigtsen , emacs-devel@gnu.org To: jao Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Feb 12 18:40: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 1lAcQt-000ABQ-9H for ged-emacs-devel@m.gmane-mx.org; Fri, 12 Feb 2021 18:40:43 +0100 Original-Received: from localhost ([::1]:41680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAcQq-0005Qs-A3 for ged-emacs-devel@m.gmane-mx.org; Fri, 12 Feb 2021 12:40:40 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAcMn-00010U-Jf for emacs-devel@gnu.org; Fri, 12 Feb 2021 12:36:29 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:53242) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAcMl-0006N0-0z; Fri, 12 Feb 2021 12:36:28 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 64924100225; Fri, 12 Feb 2021 12:36:25 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id D045D100062; Fri, 12 Feb 2021 12:36:23 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1613151383; bh=UhlybQTSDVnOvN2f36NMmq9A+Jaqee/LIlwvnb2wkdE=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=oQxB/YdL7g64/nlLWYI7Hpmu45stkntgdWXwTpEVydRidWO6PDKiN/+8be/Qi4hB0 qq0vOduHHggeaPAjdX78SooiesxjyUYy5EA3KNBr8T1cRmrJbI/VF0hVN07B4HguVy UMEeRWq5I/060RNZPjvjm6LrSK2hZi0mtblB/lfY5Gb8jl8OxnUVruRrOlTzQX1Kjk NNEpY86ynnSvHXgaDv4E4/GY0NFCulGYcDCzJIwGqeNa3Ifv8r3Mm96vpBp+JyYx/Q yNV7nwCsclcQE8M/teTAu9f3AEGPm4djJIqZqBEuvqp8zDJTZ8sL12t7qW40J8IWjV MfC0bYxnwTXPQ== Original-Received: from alfajor (unknown [216.154.41.47]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id A16B012031C; Fri, 12 Feb 2021 12:36:23 -0500 (EST) In-Reply-To: <87a6s9mf87.fsf@gnus.jao.io> (jao@gnu.org's message of "Fri, 12 Feb 2021 16:18:48 +0000") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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:264534 Archived-At: There seems to be an assumption here that the defining info to hiding a command (or not) is the current major mode. While it's an important case, I think it'd be a mistake to design a feature that can only use such tests. There are many other useful conditions that one might like to test, such as the activation of the region, the existence of some other buffer, etc... Stefan jao [2021-02-12 16:18:48] wrote: > 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.