[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master cc878319f9: Run `minibuffer-exit-hook` in the right buffer
From: |
Stefan Monnier |
Subject: |
master cc878319f9: Run `minibuffer-exit-hook` in the right buffer |
Date: |
Sun, 22 May 2022 10:39:19 -0400 (EDT) |
branch: master
commit cc878319f911a63eaab9b8382d38671b67d8abf9
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
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.
---
src/minibuf.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/minibuf.c b/src/minibuf.c
index df82bcb121..3f06ce7e0e 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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master cc878319f9: Run `minibuffer-exit-hook` in the right buffer,
Stefan Monnier <=