diff options
| author | Martin Rudalics | 2019-03-08 19:10:27 +0100 |
|---|---|---|
| committer | Martin Rudalics | 2019-03-08 19:10:27 +0100 |
| commit | 464ee80eac364e5febca88a7ded46cdd9c3a4f10 (patch) | |
| tree | 8873655aa7c4b7ac012ae05aae0310327c75be0d | |
| parent | 60b5c1090d4b378146597418627049ae574856e6 (diff) | |
| download | emacs-464ee80eac364e5febca88a7ded46cdd9c3a4f10.tar.gz emacs-464ee80eac364e5febca88a7ded46cdd9c3a4f10.zip | |
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).
| -rw-r--r-- | doc/lispref/buffers.texi | 4 | ||||
| -rw-r--r-- | src/buffer.c | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi index d97a095f686..6ad1fb1824a 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 | |||
| 940 | (@pxref{Creating Buffers}), @code{rename-buffer} (@pxref{Buffer Names}), | 940 | (@pxref{Creating Buffers}), @code{rename-buffer} (@pxref{Buffer Names}), |
| 941 | @code{kill-buffer} (@pxref{Killing Buffers}), @code{bury-buffer} (see | 941 | @code{kill-buffer} (@pxref{Killing Buffers}), @code{bury-buffer} (see |
| 942 | above) and @code{select-window} (@pxref{Selecting Windows}). | 942 | above) and @code{select-window} (@pxref{Selecting Windows}). |
| 943 | |||
| 944 | Functions run by this hook should avoid calling @code{select-window} | ||
| 945 | with a nil @var{norecord} argument or @code{with-temp-buffer} since | ||
| 946 | either may lead to infinite recursion. | ||
| 943 | @end defvar | 947 | @end defvar |
| 944 | 948 | ||
| 945 | @node Creating Buffers | 949 | @node Creating Buffers |
diff --git a/src/buffer.c b/src/buffer.c index 4ab5d4efe30..12620f0d4aa 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. * | |||
| 6236 | 6236 | ||
| 6237 | DEFVAR_LISP ("buffer-list-update-hook", Vbuffer_list_update_hook, | 6237 | DEFVAR_LISP ("buffer-list-update-hook", Vbuffer_list_update_hook, |
| 6238 | doc: /* Hook run when the buffer list changes. | 6238 | doc: /* Hook run when the buffer list changes. |
| 6239 | Functions running this hook are, `get-buffer-create', | 6239 | Functions (implicitly) running this hook are `get-buffer-create', |
| 6240 | `make-indirect-buffer', `rename-buffer', `kill-buffer', | 6240 | `make-indirect-buffer', `rename-buffer', `kill-buffer', `bury-buffer' |
| 6241 | `bury-buffer-internal' and `select-window'. */); | 6241 | and `select-window'. Functions run by this hook should avoid calling |
| 6242 | `select-window' with a nil NORECORD argument or `with-temp-buffer' | ||
| 6243 | since either may lead to infinite recursion. */); | ||
| 6242 | Vbuffer_list_update_hook = Qnil; | 6244 | Vbuffer_list_update_hook = Qnil; |
| 6243 | DEFSYM (Qbuffer_list_update_hook, "buffer-list-update-hook"); | 6245 | DEFSYM (Qbuffer_list_update_hook, "buffer-list-update-hook"); |
| 6244 | 6246 | ||