From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: How to make M-x TAB not work on (interactive) declaration? Date: Sun, 08 Jan 2023 09:34:28 +0100 Message-ID: <87y1qdct5m.fsf@gnu.org> References: <61c2cc81db661e2624771a06a1274eac.support1@rcdrun.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23264"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.9.12; emacs 30.0.50 Cc: help-gnu-emacs@gnu.org To: Jean Louis Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 08 09:45:12 2023 Return-path: Envelope-to: geh-help-gnu-emacs@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 1pERIl-0005pJ-OQ for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 08 Jan 2023 09:45:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pERI4-00074P-G1; Sun, 08 Jan 2023 03:44:28 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pERI2-00073v-Ks for help-gnu-emacs@gnu.org; Sun, 08 Jan 2023 03:44:27 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pERI2-0001YM-5v; Sun, 08 Jan 2023 03:44:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-reply-to:Date:Subject:To:From: References; bh=wGN1OoQQI0l0Y6RpxQnYjOLkyC5jxLuAs0Jm5dyasHQ=; b=D45wT+oF2vU0SH F7ZI7C5lVdpmQcIS3UT3RXlzTOdLOSsxe22UiMJovPUBrrGp69lCIQEGfCiiNBZn0DD1YIwwaZtYY nN69n2bT35u5bEw72ezChgyki69G7a8lXaJuigLfsjoyf+yWX90Hzio95tAEv62mEmgSYX8k4SFgT NT4bfAEMFrspOXCZ0pG3C5SMJVP03K3xJX14HFjOB7CQDy2Uc/V3aYx2Vge7LbtVl+MJ+a+A4qQ14 YZwxHsAQb8pS583xM4uFUy0hIbvBk+5VAThRWCfSy+I+GkWszolp0ED8eZ62IRsMA42ommwzQE9eA TFYx1JH3pR2OffkBIr2Q==; Original-Received: from auth2-smtp.messagingengine.com ([66.111.4.228]) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pERI1-0001kO-VO; Sun, 08 Jan 2023 03:44:25 -0500 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id 606C927C005A; Sun, 8 Jan 2023 03:44:25 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sun, 08 Jan 2023 03:44:25 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrkeefgdduvdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpehffgfhvfevufffjgfkgggtgfesth hqredttderjeenucfhrhhomhepvfgrshhsihhlohcujfhorhhnuceothhsughhsehgnhhu rdhorhhgqeenucggtffrrghtthgvrhhnpefgtedtudeivdfhfffhfefhvefhuedvheejje efleffheekffeutdfhgfejiefhgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgr mhepmhgrihhlfhhrohhmpehthhhorhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlh hithihqdekieejfeekjeekgedqieefhedvleekqdhtshguhheppehgnhhurdhorhhgsehf rghsthhmrghilhdrfhhm X-ME-Proxy: Feedback-ID: ib2b94485:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 8 Jan 2023 03:44:24 -0500 (EST) In-reply-to: <61c2cc81db661e2624771a06a1274eac.support1@rcdrun.com> X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:142152 Archived-At: Jean Louis writes: Hi Jean, > Reference: > (describe-function 'interactive) > > If MODES is present, it should be a list of mode names (symbols) that > this command is applicable for. The main effect of this is that =E2=80= =98M-x > TAB=E2=80=99 (by default) won=E2=80=99t list this command if the current = buffer=E2=80=99s mode > doesn=E2=80=99t match the list. That is, if either the major mode isn=E2= =80=99t > derived from them, or (when it=E2=80=99s a minor mode) the mode isn=E2=80= =99t in > effect. MODES is a &rest argument and the mode symbols shouldn't be quoted, so you use it like so: (defun my-function () (interactive nil text-mode some-other-mode) (message "Hello")) > For this example here I can still see it in M-x TAB expansion in any > mode. You also have to set (setq read-extended-command-predicate #'command-completion-default-include-p) I've added that to my init.el when the feature was built, see the info docs at (info "(emacs) M-x"): --8<---------------cut here---------------start------------->8--- In addition, =E2=80=98M-x=E2=80=99 completion can exclude commands that = are not relevant to, and generally cannot work with, the current buffer=E2=80=99s m= ajor mode (*note Major Modes::) and minor modes (*note Minor Modes::). By default, no commands are excluded, but you can customize the option =E2=80=98read-extended-command-predicate=E2=80=99 to exclude those irreleva= nt commands from completion results. --8<---------------cut here---------------end--------------->8--- You are right that this is feature is probably not documented good enough. It seems `command-completion-default-include-p' isn't documented at all (but customize knows about it) and the `interactive' docstring is missing references to that and `read-extended-command-predicate', too. I'd suggest to write a bug report. Bye, Tassilo