summaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2022-12-16 16:29:51 +0200
committerEli Zaretskii <eliz@gnu.org>2022-12-16 16:29:51 +0200
commit89f54e81576d9d9e35b67e7c5831495c4bb444c5 (patch)
treeb9782b823780065473c9b5660e6f8c3ea4554c17 /src/buffer.c
parent1b9ca1e5e646cdd678f0d29ef5e833c8ff2298c5 (diff)
downloademacs-89f54e81576d9d9e35b67e7c5831495c4bb444c5.tar.gz
emacs-89f54e81576d9d9e35b67e7c5831495c4bb444c5.tar.bz2
emacs-89f54e81576d9d9e35b67e7c5831495c4bb444c5.zip
A better fix for bug#60096
* lisp/startup.el (initial-scratch-message): * lisp/simple.el (get-scratch-buffer-create): Revert last changes. * src/window.c (Fset_window_configuration): Force recalculation of Vwindow_list after restoring the windows. * src/buffer.c (other_buffer_safely): Make sure we always return a valid buffer, even if 'get-scratch-buffer-create' signals an error.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 9a30faa0e1a..443f90ff894 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1747,7 +1747,18 @@ other_buffer_safely (Lisp_Object buffer)
if (candidate_buffer (buf, buffer))
return buf;
- return safe_call (1, Qget_scratch_buffer_create);
+ /* This function must return a valid buffer, since it is frequently
+ our last line of defense in the face of the expected buffers
+ becoming dead under our feet. safe_call below could return nil
+ if recreating *scratch* in Lisp, which does some fancy stuff,
+ signals an error in some weird use case. */
+ buf = safe_call (1, Qget_scratch_buffer_create);
+ if (NILP (buf))
+ {
+ AUTO_STRING (scratch, "*scratch*");
+ buf = Fget_buffer_create (scratch, Qnil);
+ }
+ return buf;
}
DEFUN ("buffer-enable-undo", Fbuffer_enable_undo, Sbuffer_enable_undo,