all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] New tab-bar-detach-tab command
@ 2021-09-28 19:09 Adam Porter
  2021-09-29  1:05 ` Matt Beshara
  2021-09-29  7:09 ` Juri Linkov
  0 siblings, 2 replies; 33+ messages in thread
From: Adam Porter @ 2021-09-28 19:09 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 392 bytes --]

Hi Juri, et al,

I found myself wanting to move a tab-bar tab to a new frame displaying
only that tab (like a web browser's "detach tab" command), and I
couldn't find a command to do that, so I wrote this simple one.  It
seems to work and ought to be useful, I think.

It might be worth binding it to something like "C-x t D" as well,
assuming the command is worth merging.  :)

Thanks,
Adam

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: New tab-bar-detach-tab command --]
[-- Type: text/x-diff, Size: 1067 bytes --]

From 0ffce5391c70445c8d311eb205cd566cc5f7b174 Mon Sep 17 00:00:00 2001
From: Adam Porter <adam@alphapapa.net>
Date: Tue, 28 Sep 2021 14:03:01 -0500
Subject: [PATCH] * lisp/tab-bar.el: (tab-bar-detach-tab) New command

(tab-bar-detach-tab): New command.
---
 lisp/tab-bar.el | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index abf0e81..d6a5edc 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1201,6 +1201,16 @@ tab-bar-move-tab-to-frame
       (tab-bar-tabs-set to-tabs to-frame)
       (force-mode-line-update t))))
 
+(defun tab-bar-detach-tab (tab)
+  "Detach TAB to a new frame.
+Interactively, detach current tab."
+  (interactive (list (tab-bar--current-tab-find)))
+  (let* ((tab-name (alist-get 'name (tab-bar--current-tab-find)))
+         (new-frame (make-frame `((name . ,tab-name)))))
+    (tab-bar-move-tab-to-frame nil nil nil new-frame nil)
+    (with-selected-frame new-frame
+      (tab-close 1))))
+
 \f
 (defcustom tab-bar-new-tab-to 'right
   "Defines where to create a new tab.
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2021-10-07 18:28 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-28 19:09 [PATCH] New tab-bar-detach-tab command Adam Porter
2021-09-29  1:05 ` Matt Beshara
2021-09-29  7:11   ` Juri Linkov
2021-09-29  7:43   ` Adam Porter
2021-09-29  7:09 ` Juri Linkov
2021-09-29  7:59   ` Adam Porter
2021-09-29 19:43     ` Juri Linkov
2021-09-29 19:54       ` Adam Porter
2021-10-03 17:19         ` Juri Linkov
2021-10-04 10:34           ` Adam Porter
2021-10-04 17:33             ` Juri Linkov
2021-10-04 19:53               ` Adam Porter
2021-10-05  6:49                 ` Juri Linkov
2021-10-05  7:17                   ` Adam Porter
2021-10-05 15:27                     ` [External] : " Drew Adams
2021-10-05 16:38                     ` Juri Linkov
2021-10-06 11:23                       ` Adam Porter
2021-10-06 16:38                         ` Juri Linkov
2021-10-07 18:02                           ` Juri Linkov
2021-10-07 18:23                             ` [External] : " Drew Adams
2021-10-05 15:18                   ` Drew Adams
2021-10-05 16:40                     ` Juri Linkov
2021-10-05 17:27                       ` Drew Adams
2021-10-06 16:39                         ` Juri Linkov
2021-10-06 20:20                           ` [External] : " Drew Adams
2021-10-07  7:29                             ` Juri Linkov
2021-10-07  7:43                               ` Eli Zaretskii
2021-10-07 17:58                                 ` Juri Linkov
2021-10-07 18:19                                   ` Drew Adams
2021-10-07 18:28                                   ` Eli Zaretskii
2021-10-07 15:56                               ` Drew Adams
2021-10-05 16:35                 ` Juri Linkov
2021-10-05 15:15               ` [External] : " Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.