1

Why is this function:

(defun shyn/func ()
  (declare (completion (lambda (symbol current-buffer)
                         nil)))
  (interactive))

still listed by pressing M-x TAB in buffer *scratch*?


13.14 The declare Form:

(completion COMPLETION-PREDICATE)

Declare COMPLETION-PREDICATE as a function to determine whether to include the symbol in the list of functions when asking for completions in M-x.


Update 2023-6-15

Reported as bug#64045; Related documentation got clarified.

shynur
  • 4,065
  • 1
  • 3
  • 23

1 Answers1

2

Perhaps a documentation bug.

As I quoted from the manual, the completion clause indeed has that feature as stated.
However, whether this feature is enabled is related to the value of the option read-extended-command-predicate, which the manual doesn't mention (at least not in the context of the quoted text).

(Thanks to @NickD for providing relevant and useful information.)

For instance, you can enable it like this:

(setq read-extended-command-predicate #'command-completion-default-include-p)
shynur
  • 4,065
  • 1
  • 3
  • 23