1

13.14 The declare Form:

(modes MODES)

Specify that this command is meant to be applicable for MODES only.

What is the practical effect of (modes ...) in declare form?


I find that I can still call function shyn/func:

(defun shyn/func ()
  (declare (modes text-mode))
  (interactive))

in any mode other than text-mode.


Update 2023-6-15

Reported as bug#64045; Related documentation got clarified.

shynur
  • 4,065
  • 1
  • 3
  • 23
  • I suspect that this advisory only: it is not enforced by anybody. – NickD Jun 11 '23 at 17:58
  • @NickD: I remember there seems to be an *option* that determines whether or not to ignore *command*s that are not applicable to the currently active modes when completing commands. But I forgot what it was (and if it exists, I should have turned it on ). – shynur Jun 11 '23 at 18:11
  • 1
    Are you thinking of [this](https://www.gnu.org/software/emacs/manual/html_node/elisp/Command-Modes.html) perhaps? – NickD Jun 11 '23 at 23:34
  • @NickD: Exactly! So, it's not just an advisory, is it? Perhaps you can formulate an answer based on this. – shynur Jun 12 '23 at 07:43
  • n.b. That's new in Emacs 28. See "Lisp Changes in Emacs 28.1" in the NEWS file. – phils Jun 13 '23 at 11:21

0 Answers0