Improve documentation of 'declare' forms

* lisp/simple.el (read-extended-command-predicate): Mention the
'(declare completion ...' form in the doc string.

* doc/lispref/functions.texi (Declare Form): Clarify
'completion-predicate' and 'modes'; add cross-references.
(Bug#64045)
This commit is contained in:
Eli Zaretskii 2023-06-15 09:28:26 +03:00
parent c835758238
commit 70fc7c41ef
2 changed files with 14 additions and 7 deletions

View file

@ -2609,14 +2609,18 @@ be passed to @code{gv-define-setter}.
@item (completion @var{completion-predicate}) @item (completion @var{completion-predicate})
Declare @var{completion-predicate} as a function to determine whether Declare @var{completion-predicate} as a function to determine whether
to include the symbol in the list of functions when asking for to include a function's symbol in the list of functions when asking
completions in @kbd{M-x}. @var{completion-predicate} is called with for completions in @kbd{M-x}. This predicate function will only be
two parameters: The first parameter is the symbol, and the second is called when @code{read-extended-command-predicate} is customized to
the current buffer. @code{command-completion-default-include-p}; by default the value of
@code{read-extended-command-predicate} is nil (@pxref{Interactive
Call, execute-extended-command}). The predicate
@var{completion-predicate} is called with two arguments: the
function's symbol and the current buffer.
@item (modes @var{modes}) @item (modes @var{modes})
Specify that this command is meant to be applicable for @var{modes} Specify that this command is meant to be applicable only to specified
only. @var{modes}. @xref{Command Modes}.
@item (interactive-args @var{arg} ...) @item (interactive-args @var{arg} ...)
Specify the arguments that should be stored for @code{repeat-command}. Specify the arguments that should be stored for @code{repeat-command}.

View file

@ -2225,7 +2225,10 @@ are available:
This excludes from completion candidates those commands This excludes from completion candidates those commands
which have been marked specific to modes other than the which have been marked specific to modes other than the
current buffer's mode. Commands that are not specific current buffer's mode. Commands that are not specific
to any mode are included. to any mode are included. If a command has a
`(declare completion...' form which specifies a predicate,
that predicate will be called to determine whether to
include the command in the completion candidates.
`command-completion-using-modes-p' `command-completion-using-modes-p'
This includes in completion candidates only commands This includes in completion candidates only commands