From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: How to make M-x TAB not work on (interactive) declaration? Date: Sun, 08 Jan 2023 08:06:20 +0200 Message-ID: <83h6x1r25f.fsf@gnu.org> References: <61c2cc81db661e2624771a06a1274eac.support1@rcdrun.com> 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="30108"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 08 07:06:34 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 1pEOpF-0007fo-T9 for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 08 Jan 2023 07:06:34 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEOoj-0003pu-50; Sun, 08 Jan 2023 01:06:01 -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 1pEOoh-0003pb-0x for help-gnu-emacs@gnu.org; Sun, 08 Jan 2023 01:05:59 -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 1pEOog-0003p2-OY for help-gnu-emacs@gnu.org; Sun, 08 Jan 2023 01:05:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=EyqoZ9aK1vuoJgtvwyk8GrnkS5J39wdA+99txemHE4U=; b=H3uvrXMfLb5uS0ZS7701 9mGcZJcNaMgSTq6ZBqJupaZcDYYxcWuDElcZt06lRCiXj5WYuSb67fSmOZM3ppOlp3Of7PRnBUm/Z t1PTJJr/WjAk766yX92FvprpyAsknp8S1VXvF+dsuY8TOgO28rjhNpJO1Oa5RM19CgoJVP8K6S4U4 NlJkcFjJxUdgro+9u+mee8T68XV1BciNMNMz3+fmmOSeXqm1NlePGFasS9WG0dBqh/9ZCFrXVviR3 Is2Hu1L3P80c7LnvPD4o2XuXId2YIXY3BCXRi1bn8NpV9kfSMQRl0v7aXgLlrk4r91dKw2TbcgVAH FRqbBCzED05wBQ==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEOog-0008UM-2l for help-gnu-emacs@gnu.org; Sun, 08 Jan 2023 01:05:58 -0500 In-Reply-To: <61c2cc81db661e2624771a06a1274eac.support1@rcdrun.com> (message from Jean Louis on Sat, 07 Jan 2023 23:53:48 +0300) 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:142150 Archived-At: > Date: Sat, 07 Jan 2023 23:53:48 +0300 > From: Jean Louis > > > 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 > ‘M-x TAB’ (by default) won’t list this command if the current buffer’s > mode doesn’t match the list. That is, if either the major mode isn’t > derived from them, or (when it’s a minor mode) the mode isn’t in effect. > > For this example here I can still see it in M-x TAB expansion in any > mode. > > (defun my-function () > (interactive nil '(text-mode)) > (message "Hello")) > > > And I expect not to see it. > > What am I doing wrong? The doc string is wrong: the default is to show all commands. If you want to see only those relevant to MODES, either use M-X (upper-case X) or customize read-extended-command-predicate's value to be the function command-completion-default-include-p.