GNU bug report logs - #60645
30.0.50; interactive MODES not detected properly

Previous Next

Package: emacs;

Reported by: Jean Louis <bugs <at> gnu.support>

Date: Sun, 8 Jan 2023 06:21:02 UTC

Severity: normal

Found in version 30.0.50

Full log


Message #17 received at 60645 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jean Louis <bugs <at> gnu.support>
Cc: 60645 <at> debbugs.gnu.org
Subject: Re: bug#60645: 30.0.50; interactive MODES not detected properly
Date: Sun, 08 Jan 2023 14:11:08 +0200
> Date: Sun, 8 Jan 2023 14:26:18 +0300
> From: Jean Louis <bugs <at> gnu.support>
> Cc: 60645 <at> debbugs.gnu.org
> 
> * Eli Zaretskii <eliz <at> gnu.org> [2023-01-08 12:15]:
> > Maybe one of the inconsistencies is your expectations.  What did you
> > expect to happen in each case, and why?
> 
> For this function:
> 
> (defun my-function ()
>   (interactive nil '(text-mode mail-mode))
>   (message "Hello"))
> 
> > 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.
> 
> I expect that M-x TAB shows it in this mail-mode, but it does not show
> it this time. That is one of expectations, among several.
> 
> In general, I would like to setup functions NOT to show in modes where
> they should not be shown.
> 
> I feel this function does not work.
> 
> If you have working example, show me.

The interactive form is wrong.  It should be this:

 (defun my-function ()
   (interactive nil text-mode mail-mode)
   (message "Hello"))

IOW, no quoting and no explicit list.  The documentation clearly says

  (interactive &optional ARG-DESCRIPTOR &rest MODES)

"&rest MODES" means zero or more symbols, not a quoted list.




This bug report was last modified 2 years and 158 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.