summaryrefslogtreecommitdiff
path: root/lisp/windmove.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2020-02-10 02:49:36 +0200
committerJuri Linkov <juri@linkov.net>2020-02-10 02:49:36 +0200
commitac9acc1864b02b92de4eb2e98db7b5b0cd03e019 (patch)
tree16c26e1bb91bf14ec8ed6e292a0ba961e5414ba2 /lisp/windmove.el
parent5e7bead8eac9a79dfd74452a7bd5199f12ad0c45 (diff)
downloademacs-ac9acc1864b02b92de4eb2e98db7b5b0cd03e019.tar.gz
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.
Diffstat (limited to 'lisp/windmove.el')
-rw-r--r--lisp/windmove.el25
1 files changed, 13 insertions, 12 deletions
diff --git a/lisp/windmove.el b/lisp/windmove.el
index 6e62e161548..40adb49e20f 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -467,18 +467,19 @@ When `switch-to-buffer-obey-display-actions' is non-nil,
(minibuffer-depth (minibuffer-depth))
(action (lambda (buffer alist)
(unless (> (minibuffer-depth) minibuffer-depth)
- (let ((window (cond
- ((eq dir 'new-tab)
- (let ((tab-bar-new-tab-choice t))
- (tab-bar-new-tab))
- (selected-window))
- ((eq dir 'same-window)
- (selected-window))
- (t (window-in-direction
- dir nil nil
- (and arg (prefix-numeric-value arg))
- windmove-wrap-around))))
- (type 'reuse))
+ (let* ((type 'reuse)
+ (window (cond
+ ((eq dir 'new-tab)
+ (let ((tab-bar-new-tab-choice t))
+ (tab-bar-new-tab))
+ (setq type 'tab)
+ (selected-window))
+ ((eq dir 'same-window)
+ (selected-window))
+ (t (window-in-direction
+ dir nil nil
+ (and arg (prefix-numeric-value arg))
+ windmove-wrap-around)))))
(unless window
(setq window (split-window nil nil dir) type 'window))
(setq new-window (window--display-buffer buffer window