diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/emacs/custom.texi | 16 | ||||
-rw-r--r-- | doc/lispref/commands.texi | 9 |
2 files changed, 25 insertions, 0 deletions
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index c4f112d6683..a3c9c7c206a 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -2234,6 +2234,22 @@ is included in the message displayed when the command is used: "It's better to use `kill-region' instead.\n") @end example +@findex command-query + As a less heavy-handed alternative to disabling commands, you may +want to be queried before executing a command. For instance, to be +queried before executing the @kbd{M->} (@code{end-of-buffer}) +command, you could put something like the following in your init file: + +@example +(command-query + 'end-of-buffer + "Do you really want to go to the end of the buffer?") +@end example + +By default, you'll be queried with a @kbd{y}/@kbd{n} question, but if +you give a non-@code{nil} value to the third, optional argument, +you'll be queried with @kbd{yes}/@kbd{no} instead. + @findex disable-command @findex enable-command You can make a command disabled either by editing the initialization diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index 01aa1e1fa4b..a1628eabaa2 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi @@ -3945,6 +3945,15 @@ what happens when a disabled command is invoked interactively. Disabling a command has no effect on calling it as a function from Lisp programs. +@findex command-query + The value of the @code{disabled} property can also be a list where +the first element is the symbol @code{query}. In that case, the user +will be queried whether to execute the command. The second element in +the list should be @code{nil} or non-@code{nil} to say whether to use +@code{y-or-n-p} or @code{yes-or-no-p}, respectively, and the third +element is the question to use. The @code{command-query} convenience +function should be used to enable querying for a command. + @deffn Command enable-command command Allow @var{command} (a symbol) to be executed without special confirmation from now on, and alter the user's init file (@pxref{Init |