emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-26 464ee80: Warn against recursive invocations of 'b


From: Martin Rudalics
Subject: [Emacs-diffs] emacs-26 464ee80: Warn against recursive invocations of 'buffer-list-update-hook' (Bug#34765)
Date: Fri, 8 Mar 2019 13:11:19 -0500 (EST)

branch: emacs-26
commit 464ee80eac364e5febca88a7ded46cdd9c3a4f10
Author: Martin Rudalics <address@hidden>
Commit: Martin Rudalics <address@hidden>

    Warn against recursive invocations of 'buffer-list-update-hook' (Bug#34765)
    
    * src/buffer.c (Vbuffer_list_update_hook):
    * doc/lispref/buffers.texi (Buffer List): Warn against
    recursive invocations of 'buffer-list-update-hook' (Bug#34765).
---
 doc/lispref/buffers.texi | 4 ++++
 src/buffer.c             | 8 +++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi
index d97a095..6ad1fb1 100644
--- a/doc/lispref/buffers.texi
+++ b/doc/lispref/buffers.texi
@@ -940,6 +940,10 @@ This is a normal hook run whenever the buffer list 
changes.  Functions
 (@pxref{Creating Buffers}), @code{rename-buffer} (@pxref{Buffer Names}),
 @code{kill-buffer} (@pxref{Killing Buffers}), @code{bury-buffer} (see
 above) and @code{select-window} (@pxref{Selecting Windows}).
+
+Functions run by this hook should avoid calling @code{select-window}
+with a nil @var{norecord} argument or @code{with-temp-buffer} since
+either may lead to infinite recursion.
 @end defvar
 
 @node Creating Buffers
diff --git a/src/buffer.c b/src/buffer.c
index 4ab5d4e..12620f0 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -6236,9 +6236,11 @@ The function `kill-all-local-variables' runs this before 
doing anything else.  *
 
   DEFVAR_LISP ("buffer-list-update-hook", Vbuffer_list_update_hook,
               doc: /* Hook run when the buffer list changes.
-Functions running this hook are, `get-buffer-create',
-`make-indirect-buffer', `rename-buffer', `kill-buffer',
-`bury-buffer-internal' and `select-window'.  */);
+Functions (implicitly) running this hook are `get-buffer-create',
+`make-indirect-buffer', `rename-buffer', `kill-buffer', `bury-buffer'
+and `select-window'.  Functions run by this hook should avoid calling
+`select-window' with a nil NORECORD argument or `with-temp-buffer'
+since either may lead to infinite recursion.  */);
   Vbuffer_list_update_hook = Qnil;
   DEFSYM (Qbuffer_list_update_hook, "buffer-list-update-hook");
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]