diff options
author | Adam Porter <adam@alphapapa.net> | 2021-09-29 22:37:38 +0300 |
---|---|---|
committer | Juri Linkov <juri@linkov.net> | 2021-09-29 22:37:38 +0300 |
commit | ab1e11fe796c404cad2d73dafd81da8b4329ca90 (patch) | |
tree | d6180680756159b8352151ec5cb42d4f8dd76a1b /lisp | |
parent | b0f7a27a919a5770a05ac774a4ed980588d37993 (diff) | |
download | emacs-ab1e11fe796c404cad2d73dafd81da8b4329ca90.tar.gz emacs-ab1e11fe796c404cad2d73dafd81da8b4329ca90.tar.bz2 emacs-ab1e11fe796c404cad2d73dafd81da8b4329ca90.zip |
* 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
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/tab-bar.el | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index abf0e814c41..9f64e2d1eeb 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -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. |