diff options
| author | Eli Zaretskii | 2023-06-15 09:28:26 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2023-06-15 09:28:26 +0300 |
| commit | 70fc7c41ef393078001ca339f6abe02776f2e2ae (patch) | |
| tree | a9fedc350b39443ac3d7bce9b7adf8074a1287a9 | |
| parent | c8357582389e7090744c9fbc3ea577d7d639cd1b (diff) | |
| download | emacs-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.texi | 16 | ||||
| -rw-r--r-- | lisp/simple.el | 5 |
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}) |
| 2611 | Declare @var{completion-predicate} as a function to determine whether | 2611 | Declare @var{completion-predicate} as a function to determine whether |
| 2612 | to include the symbol in the list of functions when asking for | 2612 | to include a function's symbol in the list of functions when asking |
| 2613 | completions in @kbd{M-x}. @var{completion-predicate} is called with | 2613 | for completions in @kbd{M-x}. This predicate function will only be |
| 2614 | two parameters: The first parameter is the symbol, and the second is | 2614 | called when @code{read-extended-command-predicate} is customized to |
| 2615 | the current buffer. | 2615 | @code{command-completion-default-include-p}; by default the value of |
| 2616 | @code{read-extended-command-predicate} is nil (@pxref{Interactive | ||
| 2617 | Call, execute-extended-command}). The predicate | ||
| 2618 | @var{completion-predicate} is called with two arguments: the | ||
| 2619 | function's symbol and the current buffer. | ||
| 2616 | 2620 | ||
| 2617 | @item (modes @var{modes}) | 2621 | @item (modes @var{modes}) |
| 2618 | Specify that this command is meant to be applicable for @var{modes} | 2622 | Specify that this command is meant to be applicable only to specified |
| 2619 | only. | 2623 | @var{modes}. @xref{Command Modes}. |
| 2620 | 2624 | ||
| 2621 | @item (interactive-args @var{arg} ...) | 2625 | @item (interactive-args @var{arg} ...) |
| 2622 | Specify the arguments that should be stored for @code{repeat-command}. | 2626 | Specify 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 |