From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: [External] : Re: master 927b885 1/3: Disable filtering of commands in M-x completion Date: Thu, 18 Feb 2021 11:33:57 +0200 Organization: LINKOV.NET Message-ID: <87sg5toh2y.fsf@mail.linkov.net> References: <20210217165944.26910.26583@vcs0.savannah.gnu.org> <20210217165946.030D420DFC@vcs0.savannah.gnu.org> <87blcih3ar.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12671"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: Eli Zaretskii , Stefan Kangas , "emacs-devel@gnu.org" To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Feb 18 10:57:40 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 1lCg43-0003CI-T4 for ged-emacs-devel@m.gmane-mx.org; Thu, 18 Feb 2021 10:57:39 +0100 Original-Received: from localhost ([::1]:59016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCg42-00026n-Sg for ged-emacs-devel@m.gmane-mx.org; Thu, 18 Feb 2021 04:57:38 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54414) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfzk-0004eO-GQ for emacs-devel@gnu.org; Thu, 18 Feb 2021 04:53:13 -0500 Original-Received: from relay6-d.mail.gandi.net ([217.70.183.198]:34505) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfzg-00016k-5B; Thu, 18 Feb 2021 04:53:11 -0500 X-Originating-IP: 91.129.96.116 Original-Received: from mail.gandi.net (m91-129-96-116.cust.tele2.ee [91.129.96.116]) (Authenticated sender: juri@linkov.net) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 23E58C0003; Thu, 18 Feb 2021 09:53:01 +0000 (UTC) In-Reply-To: (Drew Adams's message of "Wed, 17 Feb 2021 22:18:00 +0000") Received-SPF: pass client-ip=217.70.183.198; envelope-from=juri@linkov.net; helo=relay6-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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:265132 Archived-At: >> Also maybe a key to toggle filtering in the already active completion >> (and a key to toggle sorting). > > For filtering, why toggle instead of cycle, or > completion-choose a sort order? I.e., why allow > for only two choices? I agree, cycling is better. >> I'd like also to suggest to filter out >> commands having "r" in their interactive specs - they signal >> an error when the region is not active, so no need to show them. > > Are you sure they raise an error? > > (defun foo (&optional beg end) > (interactive "r") > (message "FOO")) Yes, I'm sure. 'M-x foo RET' without an active region raises an error: command-execute: The mark is not active now > I also think it's misleading to base filtering on > an `interactive' form that uses a string. That's > inherently fragile/limiting. It won't apply to a > form that evaluates a sexp to provide the args. > The resulting incoherence will confuse users. This means that more complex interactive specs need manual tagging using a new tag: (declare (predicate (use-region-p))) >> Also filter out commands with "*" in read-only buffers. > > Same problem. Relying on a string arg to `interactive' > is not a great idea, I think. Same tag: (declare (predicate (not buffer-read-only))) >> `describe-command' is a very good idea for searching >> and discovering commands. > > I mentioned that I defined that long ago. But I'll > also mention that `describe-function' with a prefix > arg already gives you that behavior. Oops! Nope, > that too is something I defined long ago in > `help-fns+.el'. > > Similarly, I defined `describe-option', and a prefix > arg to (my definition of) `describe-variable' limits > choices to user options (like `describe-option'). Using a prefix arg for 'C-h f' and 'C-h v' to limit the list of completions would be nice. But I guess M-x can't use a prefix arg to limit completions?