From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Adam Porter Newsgroups: gmane.emacs.devel Subject: [PATCH] New tab-bar-detach-tab command Date: Tue, 28 Sep 2021 14:09:00 -0500 Message-ID: <87h7e4ikkz.fsf@alphapapa.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31777"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Sep 28 21:14:41 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mVIYq-000860-Nh for ged-emacs-devel@m.gmane-mx.org; Tue, 28 Sep 2021 21:14:40 +0200 Original-Received: from localhost ([::1]:56968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVIYp-0007Ko-D3 for ged-emacs-devel@m.gmane-mx.org; Tue, 28 Sep 2021 15:14:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVITb-0000El-F9 for emacs-devel@gnu.org; Tue, 28 Sep 2021 15:09:15 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]:39072) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVITZ-0007WL-LZ for emacs-devel@gnu.org; Tue, 28 Sep 2021 15:09:15 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1mVITU-000Ad2-JM for emacs-devel@gnu.org; Tue, 28 Sep 2021 21:09:08 +0200 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:275728 Archived-At: --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-lisp-tab-bar.el-tab-bar-detach-tab-New-command.patch Content-Description: New tab-bar-detach-tab command >From 0ffce5391c70445c8d311eb205cd566cc5f7b174 Mon Sep 17 00:00:00 2001 From: Adam Porter 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)))) + (defcustom tab-bar-new-tab-to 'right "Defines where to create a new tab. -- 2.7.4 --=-=-=--