* lisp/tab-bar.el: (tab-bar-detach-tab) New command
(tab-bar-detach-tab): New command. (tab-bar-mouse-context-menu): Add menu entry. With thanks to Matt Beshara <m@mfa.pw> for his feedback. https://lists.gnu.org/archive/html/emacs-devel/2021-09/msg02141.html
This commit is contained in:
parent
b0f7a27a91
commit
ab1e11fe79
1 changed files with 16 additions and 0 deletions
|
@ -312,6 +312,11 @@ that closes only when clicked on the close button."
|
|||
(tab-bar-duplicate-tab
|
||||
nil ,tab-number))
|
||||
:help "Duplicate the tab"))
|
||||
(define-key-after menu [detach-tab]
|
||||
`(menu-item "Detach" (lambda () (interactive)
|
||||
(tab-bar-detach-tab
|
||||
,tab-number))
|
||||
:help "Detach the tab to new frame"))
|
||||
(define-key-after menu [close]
|
||||
`(menu-item "Close" (lambda () (interactive)
|
||||
(tab-bar-close-tab ,tab-number))
|
||||
|
@ -1201,6 +1206,17 @@ Interactively, ARG selects the ARGth different frame to move to."
|
|||
(tab-bar-tabs-set to-tabs to-frame)
|
||||
(force-mode-line-update t))))
|
||||
|
||||
(defun tab-bar-detach-tab (&optional from-number)
|
||||
"Detach tab number FROM-NUMBER to a new frame.
|
||||
Interactively or without argument, detach current tab."
|
||||
(interactive (list (1+ (tab-bar--current-tab-index))))
|
||||
(let* ((tab (nth (1- (or from-number 1)) (funcall tab-bar-tabs-function)))
|
||||
(tab-name (alist-get 'name tab))
|
||||
(new-frame (make-frame `((name . ,tab-name)))))
|
||||
(tab-bar-move-tab-to-frame nil nil from-number new-frame nil)
|
||||
(with-selected-frame new-frame
|
||||
(tab-bar-close-tab))))
|
||||
|
||||
|
||||
(defcustom tab-bar-new-tab-to 'right
|
||||
"Defines where to create a new tab.
|
||||
|
|
Loading…
Add table
Reference in a new issue