From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: Smarter M-x that filters on major-mode Date: Sat, 13 Feb 2021 12:28:20 +0100 Message-ID: <87o8goryuj.fsf@gnus.org> 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="28023"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: jao , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Feb 13 12:29:19 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 1lAt70-0007BU-NS for ged-emacs-devel@m.gmane-mx.org; Sat, 13 Feb 2021 12:29:18 +0100 Original-Received: from localhost ([::1]:50880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAt6z-0006Ah-PO for ged-emacs-devel@m.gmane-mx.org; Sat, 13 Feb 2021 06:29:17 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32822) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAt6F-0005i1-UZ for emacs-devel@gnu.org; Sat, 13 Feb 2021 06:28:31 -0500 Original-Received: from quimby.gnus.org ([2a01:4f9:2b:f0f::2]:37364) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAt6E-0006fw-CH; Sat, 13 Feb 2021 06:28:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Hl1QquMQRZIlHPTbNwj04uRq9T+py5oLYwMnQD8BpCk=; b=o1qAlu4d3ysGFedk8197YQuDYh feAJXqACqUw3Yw+OVcXnVbypruopSHS/3WoFiKxKbxQnh0lW+PjLIxTJfK3MK8IZ39s3SX6WW17Ne 63aar1YRVLtDmmEgCaOP8qNDnj36sDvvZfBfXGtlAbdSCdV/FnF9dmzeD+d8DloE1TMA=; Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lAt65-0003V9-RD; Sat, 13 Feb 2021 12:28:27 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAGFBMVEWxjBctIAdcSSTP iwGlcRAUDwKNioP////kfFCWAAAAAWJLR0QHFmGI6wAAAAd0SU1FB+UCDQsFDQ1kzDUAAAG0SURB VDjLdZJBrqMwDIbzpu8CRmP2sQrrUrgANDN7I9J9Ir3e/whjJxkKLbWQSPLFjv3bxpgvgKpf7Vp2 xpjrMTh9BJdP4Dsv3QcwvINBl8NBqP7KO8DwO6fbd55nlyMN7raC02X0nl02ovPEJVQ/NN4DkXMT WQCwT2C9kEoP5Y8gaw1cgGcEQPmjXiJ3U/DH7w3UxeU3PMPGKqCzK6Hmx6sVcG9gZ3QWoHXU6EHD pzxAPkqAqZVLUBKTtOUd0/cjV1RPyLpfAQjomOj+KwfZAxHkPuYStuC7qwAKYMiAFUijNN1SdQZC TH/pFGDbtFWsbaDZUkMRpIMdKghNC6G1UUAUlB4X9xZbpOaHMiD1kC6jgio8mp9HoDjb0Ep3TJoL W2MkG0KINs5RQPLoLFAtWqMVURrLZEV3VEBctWRHIiyN0qRVqwXnvwf9EBFHUYtooq0J+PIk+otg NkmVKk+hOtHuf88Zs1YFpGuMclqAfwK95Mtc4Q54XOfqBfhXcBk3h7wBJx0ffPc4SR1+ng5C6RuL sx/A4NZg/ALGdw95Y+mH6bCO5ZZmOw91AWcNsrjsgk/wD2nK+xwKVxX6AAAAJXRFWHRkYXRlOmNy ZWF0ZQAyMDIxLTAyLTEzVDExOjA1OjEzKzAwOjAwmpySxgAAACV0RVh0ZGF0ZTptb2RpZnkAMjAy MS0wMi0xM1QxMTowNToxMyswMDowMOvBKnoAAAAASUVORK5CYII= X-Now-Playing: Orbital's _Satan Live (3)_: "Impact (Live At The V96 Festival, Chelmsford)" In-Reply-To: (Stefan Monnier's message of "Fri, 12 Feb 2021 12:36:23 -0500") Received-SPF: pass client-ip=2a01:4f9:2b:f0f::2; envelope-from=larsi@gnus.org; helo=quimby.gnus.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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:264599 Archived-At: Stefan Monnier writes: > 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... Commands bound to modes cover 97% of the cases, my stats dept. informs me, so I think it's important to have a short, easy form to allow annotating functions according to modes -- hence the `interactive'/`command' bit: If there's any hope in having people actually do markup in this way, it should be easy to do, and the resulting code shouldn't be a chore to look at. But for the remaining 3% of the cases, a more general mechanism is needed, and that's why I added the (declare (completion PREDICATE)) thing, too. That is (interactive "p" foo-mode) is identical to (declare (completion completion-major-mode-p)) (interactive "p") in effect. But the former is nicer to type and read, I think. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no