aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2023-06-15 09:28:26 +0300
committerEli Zaretskii2023-06-15 09:28:26 +0300
commit70fc7c41ef393078001ca339f6abe02776f2e2ae (patch)
treea9fedc350b39443ac3d7bce9b7adf8074a1287a9
parentc8357582389e7090744c9fbc3ea577d7d639cd1b (diff)
downloademacs-70fc7c41ef393078001ca339f6abe02776f2e2ae.tar.gz
emacs-70fc7c41ef393078001ca339f6abe02776f2e2ae.zip
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)
-rw-r--r--doc/lispref/functions.texi16
-rw-r--r--lisp/simple.el5
2 files changed, 14 insertions, 7 deletions
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index fc902a70bf0..e646e7c8b0a 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -2609,14 +2609,18 @@ be passed to @code{gv-define-setter}.
2609 2609
2610@item (completion @var{completion-predicate}) 2610@item (completion @var{completion-predicate})
2611Declare @var{completion-predicate} as a function to determine whether 2611Declare @var{completion-predicate} as a function to determine whether
2612to include the symbol in the list of functions when asking for 2612to include a function's symbol in the list of functions when asking
2613completions in @kbd{M-x}. @var{completion-predicate} is called with 2613for completions in @kbd{M-x}. This predicate function will only be
2614two parameters: The first parameter is the symbol, and the second is 2614called when @code{read-extended-command-predicate} is customized to
2615the current buffer. 2615@code{command-completion-default-include-p}; by default the value of
2616@code{read-extended-command-predicate} is nil (@pxref{Interactive
2617Call, execute-extended-command}). The predicate
2618@var{completion-predicate} is called with two arguments: the
2619function's symbol and the current buffer.
2616 2620
2617@item (modes @var{modes}) 2621@item (modes @var{modes})
2618Specify that this command is meant to be applicable for @var{modes} 2622Specify that this command is meant to be applicable only to specified
2619only. 2623@var{modes}. @xref{Command Modes}.
2620 2624
2621@item (interactive-args @var{arg} ...) 2625@item (interactive-args @var{arg} ...)
2622Specify the arguments that should be stored for @code{repeat-command}. 2626Specify the arguments that should be stored for @code{repeat-command}.
diff --git a/lisp/simple.el b/lisp/simple.el
index 9df5958a168..406f1008df3 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2225,7 +2225,10 @@ are available:
2225 This excludes from completion candidates those commands 2225 This excludes from completion candidates those commands
2226 which have been marked specific to modes other than the 2226 which have been marked specific to modes other than the
2227 current buffer's mode. Commands that are not specific 2227 current buffer's mode. Commands that are not specific
2228 to any mode are included. 2228 to any mode are included. If a command has a
2229 `(declare completion...' form which specifies a predicate,
2230 that predicate will be called to determine whether to
2231 include the command in the completion candidates.
2229 2232
2230 `command-completion-using-modes-p' 2233 `command-completion-using-modes-p'
2231 This includes in completion candidates only commands 2234 This includes in completion candidates only commands