mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Use quit-restore-window to close tab (bug#39446)
* lisp/tab-bar.el (display-buffer-in-new-tab): New function with code from display-buffer-in-tab. (display-buffer-in-tab): Call display-buffer-in-new-tab. (switch-to-buffer-other-tab): Instead of 'display-buffer-same-window' use '(reusable-frames . t)'. * lisp/windmove.el (windmove-display-in-direction): Set arg 'type' to 'tab' for window--display-buffer when creating a new tab. * lisp/window.el (quit-restore-window): Call tab-bar-close-tab when quit-restore type is 'tab'. (display-buffer-record-window): Set window-parameter 'quit-restore' to 'tab' for type 'tab'. (window--display-buffer): Set window-prev-buffers to nil for tab too.
This commit is contained in:
parent
5e7bead8ea
commit
ac9acc1864
3 changed files with 69 additions and 28 deletions
|
|
@ -5008,6 +5008,13 @@ nil means to not handle the buffer in a particular way. This
|
|||
prev-buffer)))
|
||||
quad entry)
|
||||
(cond
|
||||
((and (not prev-buffer)
|
||||
(eq (nth 1 quit-restore) 'tab)
|
||||
(eq (nth 3 quit-restore) buffer))
|
||||
(tab-bar-close-tab)
|
||||
;; If the previously selected window is still alive, select it.
|
||||
(when (window-live-p (nth 2 quit-restore))
|
||||
(select-window (nth 2 quit-restore))))
|
||||
((and (not prev-buffer)
|
||||
(or (eq (nth 1 quit-restore) 'frame)
|
||||
(and (eq (nth 1 quit-restore) 'window)
|
||||
|
|
@ -6367,7 +6374,12 @@ fourth element is BUFFER."
|
|||
;; WINDOW has been created on a new frame.
|
||||
(set-window-parameter
|
||||
window 'quit-restore
|
||||
(list 'frame 'frame (selected-window) buffer)))))
|
||||
(list 'frame 'frame (selected-window) buffer)))
|
||||
((eq type 'tab)
|
||||
;; WINDOW has been created on a new tab.
|
||||
(set-window-parameter
|
||||
window 'quit-restore
|
||||
(list 'tab 'tab (selected-window) buffer)))))
|
||||
|
||||
(defcustom display-buffer-function nil
|
||||
"If non-nil, function to call to handle `display-buffer'.
|
||||
|
|
@ -7034,7 +7046,7 @@ Return WINDOW if BUFFER and WINDOW are live."
|
|||
;; use that.
|
||||
(display-buffer-mark-dedicated
|
||||
(set-window-dedicated-p window display-buffer-mark-dedicated))))
|
||||
(when (memq type '(window frame))
|
||||
(when (memq type '(window frame tab))
|
||||
(set-window-prev-buffers window nil))
|
||||
(let ((quit-restore (window-parameter window 'quit-restore))
|
||||
(height (cdr (assq 'window-height alist)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue