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 19:22:12 +0200 Organization: LINKOV.NET Message-ID: <87a6s1e3a3.fsf@mail.linkov.net> References: <20210217165944.26910.26583@vcs0.savannah.gnu.org> <20210217165946.030D420DFC@vcs0.savannah.gnu.org> <87blcih3ar.fsf@mail.linkov.net> <87sg5toh2y.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31531"; 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 18:58:18 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 1lCnZC-00086D-2L for ged-emacs-devel@m.gmane-mx.org; Thu, 18 Feb 2021 18:58:18 +0100 Original-Received: from localhost ([::1]:52346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCnZB-0000Al-2P for ged-emacs-devel@m.gmane-mx.org; Thu, 18 Feb 2021 12:58:17 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCnCh-0003ZY-P2 for emacs-devel@gnu.org; Thu, 18 Feb 2021 12:35:03 -0500 Original-Received: from relay7-d.mail.gandi.net ([217.70.183.200]:38283) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCnCd-0004Nd-OI; Thu, 18 Feb 2021 12:35:03 -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 relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 4D26F2000C; Thu, 18 Feb 2021 17:34:54 +0000 (UTC) In-Reply-To: (Drew Adams's message of "Thu, 18 Feb 2021 16:25:45 +0000") Received-SPF: pass client-ip=217.70.183.200; envelope-from=juri@linkov.net; helo=relay7-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_H2=-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:265172 Archived-At: >> > (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 don't see that in Emacs 27.1 or prior (with > `emacs -Q'). Is this perhaps new for 28? > If so, why would we do that? It raises an error because the value of mark-even-if-inactive was changed to nil, so the region exists only when explicitly activated. >> This means that more complex interactive specs >> need manual tagging using a new tag: >> (declare (predicate (use-region-p))) > > But even that won't handle arbitrary `interactive' > sexps, right? `declare' could use the same logic used in `interactive' that detects region boundaries. >> Same tag: >> (declare (predicate (not buffer-read-only))) > > And what about commands that might be usable > interactively, but whose `interactive' spec > doesn't encapsulate all that's involved? In that > case, manual addition of a declaration will need > to look into the logic of the command body as > well. (Admittedly, such commands are uncommon.) Yes, here it should share the same logic as well. >> 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? > > Why do you think so? `C-u M-x describe-function TAB' > (with my definition from `help-fns+.el') shows only > commands as candidates. The docstring of `execute-extended-command' says: To pass a prefix argument to the command you are invoking, give a prefix argument to ‘execute-extended-command’. And indeed `C-u M-x forward-char RET' moves 4 chars forwards. So you can't use `C-u M-x TAB' to limit the number of completions. Maybe then use another prefix like `C-x', i.e. `C-x M-x'? This is similar to how `C-x M-:' combines the prefix `C-x' to run `repeat-complex-command'.