diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index d81eba7e85c..6865a02f9e8 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -989,7 +989,7 @@ buffer and save warnings in a separate buffer." Return nil if there are no more doc strings." (let (found) (while (and (not (setq found (checkdoc--next-docstring))) - (beginning-of-defun -1))) + (beginning-of-defun-raw -1))) found)) (defun checkdoc--next-docstring () diff --git a/src/minibuf.c b/src/minibuf.c index 1dfee0a59c9..f16880011f7 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -63,7 +63,7 @@ Lisp_Object last_minibuf_string; static Lisp_Object minibuf_prompt; -/* The frame containinug the most recently opened Minibuffer. This is +/* The frame containing the most recently opened minibuffer. This is used only when `minibuffer-follows-selected-frame' is neither nil nor t. */ @@ -1248,27 +1248,36 @@ static void minibuffer_unwind (void) { struct frame *f; - struct window *w; - Lisp_Object window; - Lisp_Object entry; if (NILP (exp_MB_frame)) return; /* "Can't happen." */ f = XFRAME (exp_MB_frame); - window = f->minibuffer_window; - w = XWINDOW (window); if (FRAME_LIVE_P (f)) { - /* minibuf_window = sf->minibuffer_window; */ - if (!NILP (w->prev_buffers)) + Lisp_Object window = f->minibuffer_window; + + if (WINDOW_LIVE_P (window)) { - entry = Fcar (w->prev_buffers); - w->prev_buffers = Fcdr (w->prev_buffers); - set_window_buffer (window, Fcar (entry), 0, 0); - Fset_window_start (window, Fcar (Fcdr (entry)), Qnil); - Fset_window_point (window, Fcar (Fcdr (Fcdr (entry)))); + struct window *w = XWINDOW (window); + + /* minibuf_window = sf->minibuffer_window; */ + if (!NILP (w->prev_buffers)) + { + Lisp_Object entry = Fcar (w->prev_buffers); + + if (BUFFERP (Fcar (entry)) + && BUFFER_LIVE_P (XBUFFER (Fcar (entry)))) + { + wset_prev_buffers (w, Fcdr (w->prev_buffers)); + set_window_buffer (window, Fcar (entry), 0, 0); + Fset_window_start (window, Fcar (Fcdr (entry)), Qnil); + Fset_window_point (window, Fcar (Fcdr (Fcdr (entry)))); + } + else + set_window_buffer (window, nth_minibuffer (0), 0, 0); + } + else + set_window_buffer (window, nth_minibuffer (0), 0, 0); } - else - set_window_buffer (window, nth_minibuffer (0), 0, 0); } } diff --git a/src/window.c b/src/window.c index 559919689a3..35092ddd582 100644 --- a/src/window.c +++ b/src/window.c @@ -4230,6 +4230,9 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, specpdl_ref count = SPECPDL_INDEX (); bool samebuf = EQ (buffer, w->contents); + /* It's never OK to assign WINDOW a dead buffer. */ + eassert (BUFFER_LIVE_P (b)); + wset_buffer (w, buffer); if (EQ (window, selected_window)) diff --git a/src/xfaces.c b/src/xfaces.c index 684b6ccfac7..34897817ffd 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -736,6 +736,11 @@ recompute_basic_faces (struct frame *f) clear_face_cache (false); if (!realize_basic_faces (f)) emacs_abort (); + /* Force complete face recalculation next time we use the display + code, because realize_basic_faces could free the fontset used + by non-ASCII faces corresponding to ASCII faces of the basic + faces, and attempt to use that fontset might segfault. */ + f->face_change = true; } }