From bd094207c76c500f8a3bffe8231d8c6ae0fd0778 Mon Sep 17 00:00:00 2001 From: Basil L. Contovounesios Date: Wed, 11 Jan 2023 16:34:07 +0000 Subject: Fix buffer-list-update-hook for indirect buffers Fmake_indirect_buffer can be told whether to run buffer hooks since bug#49160, but until now it ran buffer-list-update-hook irrespective of this. * src/buffer.c (Fmake_indirect_buffer): Don't run buffer-list-update-hook when called with a non-nil INHIBIT-BUFFER-HOOKS argument. (run_buffer_list_update_hook): Don't special-case NULL argument, as no such callers remain. * test/src/buffer-tests.el (buffer-tests-inhibit-buffer-hooks-indirect): Test whether indirect buffer hooks are run regardless of whether base buffer hooks are inhibited. Check that all three buffer hooks, not just kill-buffer-query-functions, are inhibited. --- src/buffer.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 100e42fc1f9..88ca69b0dd8 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -525,14 +525,14 @@ get_truename_buffer (register Lisp_Object filename) return Qnil; } -/* Run buffer-list-update-hook if Vrun_hooks is non-nil, and BUF is NULL - or does not have buffer hooks inhibited. BUF is NULL when called by - make-indirect-buffer, since it does not inhibit buffer hooks. */ +/* Run buffer-list-update-hook if Vrun_hooks is non-nil and BUF does + not have buffer hooks inhibited. */ static void run_buffer_list_update_hook (struct buffer *buf) { - if (! (NILP (Vrun_hooks) || (buf && buf->inhibit_buffer_hooks))) + eassert (buf); + if (! (NILP (Vrun_hooks) || buf->inhibit_buffer_hooks)) call1 (Vrun_hooks, Qbuffer_list_update_hook); } @@ -907,7 +907,7 @@ does not run the hooks `kill-buffer-hook', set_buffer_internal_1 (old_b); } - run_buffer_list_update_hook (NULL); + run_buffer_list_update_hook (b); return buf; } -- cgit v1.2.1