summaryrefslogtreecommitdiff
path: root/lisp/minibuffer.el
diff options
context:
space:
mode:
authorMiha Rihtaršič <miha@kamnitnik.top>2021-07-20 14:36:45 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-07-20 14:36:45 +0200
commit7edbcb3648e9d08a4ccc291f672f831b4f07eb5c (patch)
tree30f6ce7415be55f973b0071d2d957023b9b8c4c7 /lisp/minibuffer.el
parent557c59591cb03729c7ab56719e5ed87a1f06d435 (diff)
downloademacs-7edbcb3648e9d08a4ccc291f672f831b4f07eb5c.tar.gz
emacs-7edbcb3648e9d08a4ccc291f672f831b4f07eb5c.tar.bz2
emacs-7edbcb3648e9d08a4ccc291f672f831b4f07eb5c.zip
Quit minibuffers without aborting kmacros
* doc/lispref/commands.texi (Quitting): Document `minibuffer-quit' (Recursive Editing): Document throwing of function values to `exit'. * doc/lispref/errors.texi (Standard Errors): Document `minibuffer-quit' * lisp/minibuffer.el (minibuffer-quit-recursive-edit): New function. * lisp/simple.el (minibuffer-error-function): Do not abort keyboard macro execution if is minibuffer-quit is signaled (bug#48603). * src/data.c (syms_of_data): New error symbol `minibuffer-quit' * src/keyboard.c (recursive_edit_1): Implement throwing of function values to `exit`. In that case, the function will be called without arguments before returning from the command loop. (cmd_error): (Fcommand_error_default_function): Do not abort keyboard macro execution if minibuffer-quit is signaled. (command_loop_2): New argument HANDLERS. * src/macros.c (Fexecute_kbd_macro): Use command_loop_2 instead of command_loop_1. * src/minibuf.c (Fabort_minibuffers): Use it.
Diffstat (limited to 'lisp/minibuffer.el')
-rw-r--r--lisp/minibuffer.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 813ce14c59b..1578ab8e1ea 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2328,6 +2328,15 @@ variables.")
(setq deactivate-mark nil)
(throw 'exit nil))
+(defun minibuffer-quit-recursive-edit ()
+ "Quit the command that requested this recursive edit without error.
+Like `abort-recursive-edit' without aborting keyboard macro
+execution."
+ ;; See Info node `(elisp)Recursive Editing' for an explanation of
+ ;; throwing a function to `exit'.
+ (throw 'exit (lambda ()
+ (signal 'minibuffer-quit nil))))
+
(defun self-insert-and-exit ()
"Terminate minibuffer input."
(interactive)