* lisp/tab-bar.el (tab-bar-detach-tab): Handle frame selected by make-frame.
(tab-bar-move-window-to-tab): New command. (tab-bar-new-tab-to): Handle the value 'window' of tab-bar-new-tab-choice. https://lists.gnu.org/archive/html/emacs-devel/2021-09/msg02197.html
This commit is contained in:
parent
931a7276c0
commit
0c341e6e84
1 changed files with 20 additions and 6 deletions
|
@ -1211,13 +1211,26 @@ Interactively, ARG selects the ARGth different frame to move to."
|
||||||
"Detach tab number FROM-NUMBER to a new frame.
|
"Detach tab number FROM-NUMBER to a new frame.
|
||||||
Interactively or without argument, detach current tab."
|
Interactively or without argument, detach current tab."
|
||||||
(interactive (list (1+ (tab-bar--current-tab-index))))
|
(interactive (list (1+ (tab-bar--current-tab-index))))
|
||||||
(let* ((tab (nth (1- (or from-number 1)) (funcall tab-bar-tabs-function)))
|
(let* ((tabs (funcall tab-bar-tabs-function))
|
||||||
(tab-name (alist-get 'name tab))
|
(tab-index (1- (or from-number (1+ (tab-bar--current-tab-index tabs)))))
|
||||||
|
(tab-name (alist-get 'name (nth tab-index tabs)))
|
||||||
|
;; On some window managers, `make-frame' selects the new frame,
|
||||||
|
;; so previously selected frame is saved to `from-frame'.
|
||||||
|
(from-frame (selected-frame))
|
||||||
(new-frame (make-frame `((name . ,tab-name)))))
|
(new-frame (make-frame `((name . ,tab-name)))))
|
||||||
(tab-bar-move-tab-to-frame nil nil from-number new-frame nil)
|
(tab-bar-move-tab-to-frame nil from-frame from-number new-frame nil)
|
||||||
(with-selected-frame new-frame
|
(with-selected-frame new-frame
|
||||||
(tab-bar-close-tab))))
|
(tab-bar-close-tab))))
|
||||||
|
|
||||||
|
(defun tab-bar-move-window-to-tab ()
|
||||||
|
"Detach the selected window to a new tab."
|
||||||
|
(interactive)
|
||||||
|
(let ((tab-bar-new-tab-choice 'window))
|
||||||
|
(tab-bar-new-tab))
|
||||||
|
(tab-bar-switch-to-recent-tab)
|
||||||
|
(delete-window)
|
||||||
|
(tab-bar-switch-to-recent-tab))
|
||||||
|
|
||||||
|
|
||||||
(defcustom tab-bar-new-tab-to 'right
|
(defcustom tab-bar-new-tab-to 'right
|
||||||
"Defines where to create a new tab.
|
"Defines where to create a new tab.
|
||||||
|
@ -1264,9 +1277,10 @@ After the tab is created, the hooks in
|
||||||
(select-window (minibuffer-selected-window)))
|
(select-window (minibuffer-selected-window)))
|
||||||
(let ((ignore-window-parameters t))
|
(let ((ignore-window-parameters t))
|
||||||
(delete-other-windows))
|
(delete-other-windows))
|
||||||
;; Create a new window to get rid of old window parameters
|
(unless (eq tab-bar-new-tab-choice 'window)
|
||||||
;; (e.g. prev/next buffers) of old window.
|
;; Create a new window to get rid of old window parameters
|
||||||
(split-window) (delete-window)
|
;; (e.g. prev/next buffers) of old window.
|
||||||
|
(split-window) (delete-window))
|
||||||
(let ((buffer
|
(let ((buffer
|
||||||
(if (functionp tab-bar-new-tab-choice)
|
(if (functionp tab-bar-new-tab-choice)
|
||||||
(funcall tab-bar-new-tab-choice)
|
(funcall tab-bar-new-tab-choice)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue