summaryrefslogtreecommitdiff
path: root/lisp/minibuffer.el
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2021-02-11 21:37:45 +0000
committerAlan Mackenzie <acm@muc.de>2021-02-11 21:37:45 +0000
commit203e61ff837128b397eb313a5bb1b703f0eae0ec (patch)
treefa2a96312dd4ec237bcf2a2baa7439ed83f351d2 /lisp/minibuffer.el
parent4f63b4bfc6c16abeaf9d8a9e9de76cc42d772567 (diff)
downloademacs-203e61ff837128b397eb313a5bb1b703f0eae0ec.tar.gz
emacs-203e61ff837128b397eb313a5bb1b703f0eae0ec.tar.bz2
emacs-203e61ff837128b397eb313a5bb1b703f0eae0ec.zip
Make recursive minibuffers and recursive edits work together
* lisp/minibuffer.el (exit-minibuffer): When in a minibuffer, throw an error should the command loop nesting level be wrong. * src/lisp.h (minibuffer_quit_level): declare as an extern. (command_loop_level): Move definition from src/window.h * src/window.h (command_loop_level): move definition to src/lisp.h. * src/eval.c (minibuffer_quit_level): Move this variable to file level from being a static inside internal_catch. (internal_catch): Simplify the logic. * src/minibuf.c (Vcommand_loop_level_list): New variable. (move_minibuffer_onto_frame): Set the major mode of *Minibuf-0*. (Fminibuffer_innermost_command_loop_p): New primitive. (Fabort_minibuffers): Check the command loop level before throwing t to 'exit, and set minibuffer_quit_level too. (read_minibuf): New variable calling_window. Before stacking up minibuffers on the current mini-window, check that the mini-window is not the current one. Do not call choose_minibuf_frame from read_minibuf's unwinding process. Bind calling_frame and calling_window over the recursive edit. Set the new minibuffer's major mode directly. Remove the switching away from the minibuffer after the recursive edit. (get_minibuffer): Record the command loop level in new variable Vcommand_loop_level_list. No longer set the major mode of a returned minibuffer. (minibuf_c_loop_level): New function. (read_minibuf_unwind): New variables calling_frame, calling_window are unbound from the binding stack. Remove old variable `window', which could not be set reliably to the expired mini-window. The expired minibuffer is determined as the nth in the list, rather than the contents of the current or previous mini-window. Switch the current window away from the mini-window here (moved from read_minibuf).
Diffstat (limited to 'lisp/minibuffer.el')
-rw-r--r--lisp/minibuffer.el13
1 files changed, 7 insertions, 6 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index a899a943d4c..aacb8ab00bb 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2116,18 +2116,19 @@ variables.")
(defun exit-minibuffer ()
"Terminate this minibuffer argument."
(interactive)
- (when (or
- (innermost-minibuffer-p)
- (not (minibufferp)))
+ (when (minibufferp)
+ (when (not (minibuffer-innermost-command-loop-p))
+ (error "%s" "Not in most nested command loop"))
+ (when (not (innermost-minibuffer-p))
+ (error "%s" "Not in most nested minibuffer")))
;; If the command that uses this has made modifications in the minibuffer,
;; we don't want them to cause deactivation of the mark in the original
;; buffer.
;; A better solution would be to make deactivate-mark buffer-local
;; (or to turn it into a list of buffers, ...), but in the mean time,
;; this should do the trick in most cases.
- (setq deactivate-mark nil)
- (throw 'exit nil))
- (error "%s" "Not in most nested minibuffer"))
+ (setq deactivate-mark nil)
+ (throw 'exit nil))
(defun self-insert-and-exit ()
"Terminate minibuffer input."