help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to make M-x TAB not work on (interactive) declaration?


From: Eli Zaretskii
Subject: Re: How to make M-x TAB not work on (interactive) declaration?
Date: Sun, 08 Jan 2023 08:06:20 +0200

> Date: Sat, 07 Jan 2023 23:53:48 +0300
> From: Jean Louis <bugs@gnu.support>
> 
> 
> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]