diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-05-22 10:35:02 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-05-22 10:39:02 -0400 |
commit | cc878319f911a63eaab9b8382d38671b67d8abf9 (patch) | |
tree | 74c963f5e94f0518bca0a25c1648c35427437482 | |
parent | 5088ebc8eb7f5451be195481f00c73ba994efa52 (diff) | |
download | emacs-cc878319f911a63eaab9b8382d38671b67d8abf9.tar.gz |
Run `minibuffer-exit-hook` in the right buffer
* src/minibuf.c (run_exit_minibuf_hook): Take the minibuffer as arg
and run the hook in that buffer.
(read_minibuf): Adjust accordingly.
-rw-r--r-- | src/minibuf.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/minibuf.c b/src/minibuf.c index df82bcb121a..3f06ce7e0e3 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -265,7 +265,7 @@ without invoking the usual minibuffer commands. */) static void read_minibuf_unwind (void); static void minibuffer_unwind (void); -static void run_exit_minibuf_hook (void); +static void run_exit_minibuf_hook (Lisp_Object minibuf); /* Read a Lisp object from VAL and return it. If VAL is an empty @@ -749,7 +749,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, separately from read_minibuf_unwind because we need to make sure that read_minibuf_unwind is fully executed even if exit-minibuffer-hook signals an error. --Stef */ - record_unwind_protect_void (run_exit_minibuf_hook); + record_unwind_protect (run_exit_minibuf_hook, minibuffer); /* Now that we can restore all those variables, start changing them. */ @@ -1076,9 +1076,14 @@ static EMACS_INT minibuf_c_loop_level (EMACS_INT depth) } static void -run_exit_minibuf_hook (void) +run_exit_minibuf_hook (Lisp_Object minibuf) { + specpdl_ref count = SPECPDL_INDEX (); + record_unwind_current_buffer (); + if (BUFFER_LIVE_P (XBUFFER (minibuf))) + Fset_buffer (minibuf); safe_run_hooks (Qminibuffer_exit_hook); + unbind_to (count, Qnil); } /* This variable records the expired minibuffer's frame between the |