In 'replace-buffer-in-windows' try to preserve current buffer (Bug#75949)
* lisp/window.el (replace-buffer-in-windows): Preserve current buffer when 'kill-buffer-quit-windows' is non-nil and a window showing BUFFER shall be quit. Running 'kill-buffer-hook' relies on it (Bug#75949).
This commit is contained in:
parent
f45a776fe3
commit
4354cf73d7
1 changed files with 6 additions and 1 deletions
|
@ -5224,7 +5224,12 @@ buffer by itself."
|
|||
(cond
|
||||
((window-minibuffer-p window))
|
||||
(kill-buffer-quit-windows
|
||||
(quit-restore-window window 'killing))
|
||||
;; Try to preserve the current buffer set up by 'kill-buffer'
|
||||
;; before running the hooks on 'kill-buffer-hook' (Bug#75949).
|
||||
(let ((current-buffer (current-buffer)))
|
||||
(quit-restore-window window 'killing)
|
||||
(when (buffer-live-p current-buffer)
|
||||
(set-buffer current-buffer))))
|
||||
(t
|
||||
(let ((dedicated-side (eq (window-dedicated-p window) 'side)))
|
||||
(when (or dedicated-side (not (window--delete window t 'kill)))
|
||||
|
|
Loading…
Add table
Reference in a new issue