From 13b9268374669c368343ce4279041f2021b264f6 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 14 Feb 2022 11:20:41 +0100 Subject: Add a mechanism for querying before executing a command * doc/emacs/custom.texi (Disabling): Document it. * doc/lispref/commands.texi (Disabling Commands): Document the low-level stuff. * lisp/simple.el (command-execute): Respect the `(query ...)' value for `disabled'. (command-execute--query): New function. (command-query): New function. --- doc/lispref/commands.texi | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'doc/lispref') 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 -- cgit v1.2.3