From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#38354: 27.0.50; Implement display action display-buffer-in-tab Date: Tue, 03 Dec 2019 01:43:02 +0200 Organization: LINKOV.NET Message-ID: <87h82i9tvd.fsf@mail.linkov.net> References: <87imna2nsi.fsf@mail.linkov.net> <8736ea5kcz.fsf@mail.linkov.net> <7979be54-2a01-2e97-d956-2500e7999e26@gmx.at> <87d0dd3yb7.fsf@mail.linkov.net> <87r21r389g.fsf@mail.linkov.net> <87lfrvk7cg.fsf@mail.linkov.net> <6be9eb15-062d-b15f-04c8-993a2a2eee22@gmx.at> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="17825"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 38354@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 03 00:47:34 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ibvPg-0004SA-Vq for geb-bug-gnu-emacs@m.gmane.org; Tue, 03 Dec 2019 00:47:33 +0100 Original-Received: from localhost ([::1]:45764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibvPf-0003Td-9q for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Dec 2019 18:47:31 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42933) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibvPJ-0003RR-1t for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2019 18:47:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ibvPH-0004FF-MV for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2019 18:47:08 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33151) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ibvPD-0004DI-Q2 for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2019 18:47:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ibvPD-0005Ae-N6 for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2019 18:47:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Dec 2019 23:47:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38354 X-GNU-PR-Package: emacs Original-Received: via spool by 38354-submit@debbugs.gnu.org id=B38354.157533041419850 (code B ref 38354); Mon, 02 Dec 2019 23:47:03 +0000 Original-Received: (at 38354) by debbugs.gnu.org; 2 Dec 2019 23:46:54 +0000 Original-Received: from localhost ([127.0.0.1]:39123 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ibvP3-0005A6-Ff for submit@debbugs.gnu.org; Mon, 02 Dec 2019 18:46:53 -0500 Original-Received: from aye.elm.relay.mailchannels.net ([23.83.212.6]:55428) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ibvP1-00059x-HY for 38354@debbugs.gnu.org; Mon, 02 Dec 2019 18:46:52 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 41ACDE0581; Mon, 2 Dec 2019 23:46:50 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a98.g.dreamhost.com (100-96-87-246.trex.outbound.svc.cluster.local [100.96.87.246]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id B21A1E049A; Mon, 2 Dec 2019 23:46:49 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a98.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.5); Mon, 02 Dec 2019 23:46:50 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Oafish-Sponge: 5c517ffc7664fd39_1575330409953_1171783508 X-MC-Loop-Signature: 1575330409953:912417907 X-MC-Ingress-Time: 1575330409952 Original-Received: from pdx1-sub0-mail-a98.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a98.g.dreamhost.com (Postfix) with ESMTP id 503958017B; Mon, 2 Dec 2019 15:46:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=DVJZtVg6J2Fad2BgAQKEHJUHJl8=; b= uza9Ele5qkkFbagqxU+anYl6pr18l5MZAHcuopUhq78Y5R5CAfV/x/pptHnjEnzY 92c3JihjywiQlUlKGYE8c+A82sMyvWWU6+UgxRfjzHtaTFcM/uSMuoSTtI5Bef3D 0071YdyTT64nhSXGDZLNmO19VXKnrkiTQC9bh3VO3vE= Original-Received: from mail.jurta.org (m91-129-96-42.cust.tele2.ee [91.129.96.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a98.g.dreamhost.com (Postfix) with ESMTPSA id 5B98F80173; Mon, 2 Dec 2019 15:46:41 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a98 In-Reply-To: <6be9eb15-062d-b15f-04c8-993a2a2eee22@gmx.at> (martin rudalics's message of "Mon, 2 Dec 2019 10:40:14 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:172792 Archived-At: --=-=-= Content-Type: text/plain > With "moving" I really meant "copying" or "cloning" with the > additional possibility of deleting the original. So there should be > only one question: Can we simply make a copy of a tab using its window > state (window configurations can't be used because we cannot clone > windows). If not, what is the problem? Implemented in the patch below that deletes the window-configuration from the copied tab, but leaves its window-state. >> An additional question to consider is how to interactively select >> an another frame: by frame name, or using other-frame with a numeric >> prefix argument? > > How is this question related to tabs? Easier to implement than to explain :) The same patch uses its ARG the same way as it's used in 'other-frame' to find ARGth frame where to copy the tab. >> (push '("test1" . >> (display-buffer-reuse-window >> (reusable-frames . visible) >> (use-tabs . t))) >> display-buffer-alist) > > There is one thing I apparently do not understand yet: When you enable > 'tab-bar-mode' it is global Do you think we should have 'global-tab-bar-mode' for all frames, and 'tab-bar-mode' to enable/disable the tab-bar in every frame separately? > - that is any window ever shown on any frame is also in at least one > of that frame's tabs. Is that right? So what would 'use-tabs' mean > here when every window is in a tab already? These windows in tabs are in window-configurations and window-states. Now I installed tab-bar-get-buffer-tab that can be used in display-buffer-reuse-window to search the buffer in window-states of tabs when use-tabs is non-nil. >>> By default, a new tab starts with the current buffer that was current >>> before calling the command that adds a new tab. >>> >>> That's confusing, at least. >> >> Maybe this is better? >> >> By default, a new tab starts with the buffer that was current >> before calling the command that adds a new tab. > > The current buffer is IMHO a much too obscure object to consider here. > Don't you mean the buffer of the selected window? The manual refers to the default value of tab-bar-new-tab-choice with its docstring: If t, start a new tab with the current buffer, i.e. the buffer that was current before calling the command that adds a new tab (this is the same what `make-frame' does by default). --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=tab-bar-move-tab-to-frame.patch diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index a36be13e37..340f012247 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -645,6 +645,33 @@ tab-bar-move-tab (to-index (mod (+ from-index arg) (length tabs)))) (tab-bar-move-tab-to (1+ to-index) (1+ from-index)))) +(defun tab-bar-move-tab-to-frame (arg &optional from-frame from-index to-frame to-index) + "Move tab from FROM-INDEX position to new position at TO-INDEX. +FROM-INDEX defaults to the current tab index. +FROM-INDEX and TO-INDEX count from 1. +FROM-FRAME specifies the source frame and defaults to the selected frame. +TO-FRAME specifies the target frame and defaults the next frame. +Interactively, ARG selects the ARGth different frame to move to." + (interactive "P") + (unless from-frame + (setq from-frame (selected-frame))) + (unless to-frame + (dotimes (_ (prefix-numeric-value arg)) + (setq to-frame (next-frame to-frame)))) + (unless (eq from-frame to-frame) + (let* ((from-tabs (with-selected-frame from-frame + (funcall tab-bar-tabs-function))) + (from-index (or from-index (1+ (tab-bar--current-tab-index from-tabs)))) + (from-tab (nth (1- from-index) from-tabs)) + (to-tabs (with-selected-frame to-frame + (funcall tab-bar-tabs-function))) + (to-index (max 0 (min (1- (or to-index 1)) (1- (length to-tabs)))))) + (setq from-tabs (delq from-tab from-tabs)) + (cl-pushnew (assq-delete-all 'wc from-tab) (nthcdr to-index to-tabs)) + (set-frame-parameter from-frame 'tabs from-tabs) + (set-frame-parameter to-frame 'tabs to-tabs) + (force-mode-line-update t)))) + (defcustom tab-bar-new-tab-to 'right "Defines where to create a new tab. --=-=-=--