summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
authorMartin Rudalics <rudalics@gmx.at>2024-09-11 10:36:14 +0200
committerMartin Rudalics <rudalics@gmx.at>2024-09-11 10:36:14 +0200
commitfc3a7f45292b9a7be95fdefd24fedb7e8f564d1c (patch)
tree42c8f350f181c8705564f4320054c0fdaefbba77 /src/window.c
parent74ea24233ca281b19c3e3d2552621ceac30dfc48 (diff)
downloademacs-fc3a7f45292b9a7be95fdefd24fedb7e8f564d1c.tar.gz
emacs-fc3a7f45292b9a7be95fdefd24fedb7e8f564d1c.tar.bz2
emacs-fc3a7f45292b9a7be95fdefd24fedb7e8f564d1c.zip
For minibuffer windows record minibuffers only (Bug#72487)
* src/minibuf.c (zip_minibuffer_stacks): Use wset type functions. Call 'record-window-buffer' instead of 'push-window-buffer-onto-prev' to handle all sorts of buffers shown in minibuffer windows in a uniform way. (read_minibuf): Call 'record-window-buffer' instead of 'push-window-buffer-onto-prev' for same reason as previous. * lisp/calculator.el (calculator-update-display) (calculator-save-and-quit): Make sure calculator buffer is live before operating on it. * lisp/window.el (record-window-buffer): Handle case where WINDOW is a minibuffer window: Unconditionally remove WINDOW's buffer from WINDOW's list of previous buffers and push it if and only if it is a live minibuffer (Bug#72487). Do not run 'buffer-list-update-hook' if WINDOW is a minibuffer window. (push-window-buffer-onto-prev): Make it an alias of 'record-window-buffer' so it will run the latter's checks. (replace-buffer-in-windows): Handle minibuffer windows and rewrite doc-string accordingly. * doc/lispref/windows.texi (Buffers and Windows): Explain handling of minibuffer windows in 'replace-buffer-in-windows'.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/window.c b/src/window.c
index 35092ddd582..34968ac824f 100644
--- a/src/window.c
+++ b/src/window.c
@@ -3647,9 +3647,17 @@ replace_buffer_in_windows (Lisp_Object buffer)
call1 (Qreplace_buffer_in_windows, buffer);
}
-/* If BUFFER is shown in a window, safely replace it with some other
- buffer in all windows of all frames, even those on other keyboards. */
-
+/** If BUFFER is shown in any window, safely replace it with some other
+ buffer in all windows of all frames, even those on other keyboards.
+ Do not delete any window.
+
+ This function is called by Fkill_buffer when it detects that
+ replacing BUFFER in some window showing BUFFER has failed. It
+ assumes that ‘replace-buffer-in-windows’ has removed any entry
+ referencing BUFFER from any window's lists of previous and next
+ buffers and that window's ‘quit-restore’ and 'quit-restore-prev'
+ parameters.
+*/
void
replace_buffer_in_windows_safely (Lisp_Object buffer)
{