GNU bug report logs - #38354
27.0.50; Implement display action display-buffer-in-tab

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Juri Linkov <juri@HIDDEN>; dated Sat, 23 Nov 2019 23:11:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 38354 <at> debbugs.gnu.org:


Received: (at 38354) by debbugs.gnu.org; 28 Nov 2019 09:21:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 28 04:21:12 2019
Received: from localhost ([127.0.0.1]:56626 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iaFz5-0003wn-Lb
	for submit <at> debbugs.gnu.org; Thu, 28 Nov 2019 04:21:11 -0500
Received: from mout.gmx.net ([212.227.15.19]:45951)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rudalics@HIDDEN>) id 1iaFz4-0003wa-0r
 for 38354 <at> debbugs.gnu.org; Thu, 28 Nov 2019 04:21:10 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1574932860;
 bh=pwO83e8VGqG94cWFIgR9EIoGdiKVwBnSMJp6wgEP+9A=;
 h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To;
 b=C3k2YL45NndoXrvvKeyrUNnNF0tzudMpt2mgnTXQgkdAzVFVGh9paKS1FTGmi06/J
 bF2UboLvHyjmXHRdxHzqs/DmJI7wRQsUqHH60FEugsS8ZBukowcHDFZa0JOl61YKPp
 lTaTH9iFF/wlS3G49aHVu8eFgZ+v2XKfYCnF8vo8=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from [192.168.1.101] ([46.125.249.73]) by mail.gmx.com (mrgmx004
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MsHns-1hgeWH3jg2-00tjXW; Thu, 28
 Nov 2019 10:21:00 +0100
Subject: Re: bug#38354: 27.0.50; Implement display action display-buffer-in-tab
To: Juri Linkov <juri@HIDDEN>
References: <87imna2nsi.fsf@HIDDEN>
 <cc86d5bd-76fd-7a70-71b7-caa9bb4ad3c6@HIDDEN>
 <8736ea5kcz.fsf@HIDDEN>
 <7979be54-2a01-2e97-d956-2500e7999e26@HIDDEN>
 <87d0dd3yb7.fsf@HIDDEN>
From: martin rudalics <rudalics@HIDDEN>
Message-ID: <ab6bf14e-e34e-8627-eb29-afd93087e9d9@HIDDEN>
Date: Thu, 28 Nov 2019 10:20:59 +0100
MIME-Version: 1.0
In-Reply-To: <87d0dd3yb7.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: de-AT
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K1:+FTzbcCwl4hA8cak7uQGWVLb9bLrMCgRFMVMlh3dvXOLggiu463
 7oKpJaJKWjS1/lg0xSgM3y/Q4eGonC7piw6w9mF2P+oYWeHRXfe8g0Rz27GeHp+HsATBGYE
 SlfNkdWzcQokJ4Tq+S72orOfIFLnZerFsIR4VkUhVg7bQUlU/zhbp8k0SEdq7xI+WE2MlHR
 vuQCilMiubSMa745gNEew==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:z1uKOR6tIa0=:yNZw2YAGOUyM1bGWSiplk1
 RAUUsdtt2g2B0Qc4i7OJKRlwvYZNqklC9tI9RKrUmZhf9hq1TIPd5YOof/R7JSjiAPtZVB1O7
 mJSDWUlzNXndvQgpxl1ikWZDKigdSHFhHsnw0QD23lXtomBHS7B7Ags2ImVPtBsI2clFUa/GE
 HWQqO9Y0iRgxUT3zy+ygSPJ3R6oy4l7tH1vHuTxTELumJj+9ZmGipVbWnFL+KInDtxjtdVqQW
 rr+ynP6EWw/XZGx8esf/RXmX+Zd21/JFr5YZeuJPm5qYEHXoqV42ZQ3LIPRjN3Ypl5q9uEwD9
 1Sn51DkzbmL0KXE85GVg3UGfCMc419Ve7CqD/H7RDz2KxrpZkpIva/dtPxAIay8uB/1roggNb
 c9xnIR3ZxGLBImfc2HxScWVFu+QY1A2fIg/c0hjYg9cGeiMHfgy95uvLKmynmXmkuI0bF3WDx
 pqmk8xTcgs/m6M3YAwOb+5MaUSi+C+iSG0LqRDzoZRd2LFyz0xFKORoBotWeDedGaDtO+YZPi
 0t4HC95zVSgv+AGKvozP56Y1NFHzOejCYcmyeaMnIqquQXF4pwgyHxPJbxyEt1dDonN2mjBrQ
 2o90AoPkXSqqCGU0riWvLPcSnqckVUskBi9alf09R3j+/mpv2vfJKN/mbhAmeX0G4jRktDUHr
 wEPvmmG1s2yiqz2873s+oaBxmdNrrHb3qS/NdU+NCq1WsjHn8QtTS4HozzZWa7U2+XgPR/xs9
 fUVE9ijGS6+fQei3fqmK6xsP9mZW1L4LCpkS5/NPrgkIa0jocomcU3cECfTVW2EYpnats0Xaa
 5D6qTdhHA3YrCumu3rcZaLjZgFrmfEtmj8VSCN+tmDWTirxutPyg39p5aoUMDMJPPL0uHKeaP
 5ESibjiP0GL6D3bCuSzIFKCBoFmUXo7YgOsX4QFhSjSOsvNjFB7/3VedYBX9SG2CcqP1jJl4A
 WxCVJWRt4EZeWxMWRbqe+uSMIOcukDsnw+ZB9R3dxXZxfSA1M3IEMlXeS/cKL99tsXo9yG9y3
 kOWc0qFclB2i48SXIvYjKN/2duEANDSXrBJpYDOhWNR6S19NoWMxGzeF4Xdi0rz/Ia+y0gEv9
 UC+jFKWD5Y7UeGzponfL7Cm+mm70ZDIBYfAHAva9EvaMnpFgVKV8/GzoGVeQc5asTV/erNBSh
 huExIA/dRO4+aCGCFcXEB48TUxxP+mn9pZ9BYY6HVzXO6oi/z3z3QE6euQH1NrCKA1P1F3TnF
 ErwAD4HICK20X5Y6WQ1PIGldsh4XcT9+r4+m2r/LZ5L3vU4AVbf045x1RujzNYYk3jYpaZJx6
 Q0Uu6IjW
X-Spam-Score: 3.6 (+++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  >>> display-buffer-in-tab is implemented now, but we need
 also an action >>> to display the buffer in an existing tab if such buffer
 is >>> already displayed in it. >> >> Could we please clarify the [...] 
 Content analysis details:   (3.6 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
 [46.125.249.73 listed in zen.spamhaus.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (rudalics[at]gmx.at)
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: dictionary.com]
X-Debbugs-Envelope-To: 38354
Cc: 38354 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 2.6 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  >>> display-buffer-in-tab is implemented now, but we need
    also an action >>> to display the buffer in an existing tab if such buffer
    is >>> already displayed in it. >> >> Could we please clarify the [...] 
 
 Content analysis details:   (2.6 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
                             blocked.  See
                             http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
                              for more information.
                             [URIs: urbandictionary.com]
  3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
                             [46.125.249.73 listed in zen.spamhaus.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (rudalics[at]gmx.at)
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

 >>> display-buffer-in-tab is implemented now, but we need also an action
 >>> to display the buffer in an existing tab if such buffer is
 >>> already displayed in it.
 >>
 >> Could we please clarify the term "display(ed)" in this context.  IIUC
 >> you use it
 >>
 >> - to say that a buffer is part of a tab (a window configuration that
 >>    can be shown on a frame), and
 >
 > In my code I use for this:
 >
 >    (tab-bar-buffer-visible-in-tabs-p buffer)

But this may also return non-nil when the buffer is invisible, that is
not shown in any window.  We already have the "visible frames"
notation, including the non-obscured frames connotation, so I'd rather
not use the term visible in the context of tabs.  Wouldn't something
like 'tab-bar-buffer-present-in-tabs-p' or 'tab-bar-buffer-in-tabs-p'
be more intuitive?

 >> - to say that a buffer is actually displayed on a frame that has a
 >>    tab-bar.
 >
 > In my code I use for this:
 >
 >    (>= (length (get-buffer-window-list buffer t t)) 1)

Why not simply 'get-buffer-window'?  In either case what does the
above "displayed" in

 >>> to display the buffer in an existing tab if such buffer is
 >>> already displayed in it.

refer to now?  The former, the latter or their

 > i.e. I check these situations differently, and use 'or'
 > to combine these conditions:
 >
 >    (or (>= (length (get-buffer-window-list buffer t t)) 1)
 >        (tab-bar-buffer-visible-in-tabs-p buffer))
 >
 > Should these conditions be combined in one function
 > (if the current tab can be considered a tab as well)?

'or'?

 >> Right?  Then the former should not use the term "display(ed)" but
 >> maybe something like "tab(bed)".  "Tab a buffer" would then mean to
 >> make sure that the buffer is part of a tab, "tabbed" that it is part
 >> of at least one tab.
 >
 > Not sure if "tabbed" is the right word.  None of these definitions fits:
 > https://www.dictionary.com/browse/tabbed
 > https://www.urbandictionary.com/define.php?term=tabbed

'tab' itself is already problematic, as we know.

 >>> This will require a new function function tab-bar-buffer-visible-in-tabs.
 >>
 >> What would "visible" precisely stand for here?
 >
 > Maybe a better word is "has"?  Then the name would be tab-bar-has-buffer-in-tab.

OK.  But I think that the "has" is superfluous.

 >> And why "tabs" indiscriminately?  Don't you ever want to check for
 >> presence or visibility in a specific tab only?
 >
 > A specific tab referred by name?  Maybe such function could be useful as well.

Don't you ever want to discriminate the tabs of the selected frame
from the tabs of other frames?  Or are they all the same?

 >> 'display-buffer-reuse-window' together with 'reusable-frames' should
 >> have all the ingredients for this.  What is missing?
 >
 > Than we need to add 'reusable-tabs'?

Why?  If a target tab (a tab with the name specified by ALIST) exists
on any frame specified by 'reusable-frames', reuse it.  Otherwise make
a new frame with the target tab as its only entry.

 >>> Also I use this function in a wrapper that kills the buffer, such wrapper checks
 >>>
 >>>     (tab-bar-buffer-visible-in-tabs-p (current-buffer))
 >>>
 >>> If true, it doesn't kill the buffer, but buries it.
 >>
 >> Via 'kill-buffer-query-functions'?
 >
 > Rather calling it explicitly with a new commands, but it should be
 > possible to use 'kill-buffer-query-functions' too.

But the idea is to _not_ kill the buffer.  Right?  So this might be a
disconcerting effect.

 >>> So switching back to that tab still displays the buffer.
 >>
 >> When I do 'kill-buffer', I expect that buffer to get removed from
 >> 'buffer-list' and all windows showing it, that it won't be switched to
 >> by many functions and so on.  Whatever we'd do, we have to manage this
 >> controversy somehow.  Think of changes or the deletion of the visited
 >> files.  How would we try to avoid saving such buffers to their files
 >> in that case?
 >
 > A buffer can't be removed from saved window-configurations and window-states.

The buffer's object can be removed.  The buffer reference in a saved
window structure is weak, it cannot prevent collecting the buffer
object.

martin




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38354; Package emacs. Full text available.

Message received at 38354 <at> debbugs.gnu.org:


Received: (at 38354) by debbugs.gnu.org; 27 Nov 2019 21:56:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 27 16:56:29 2019
Received: from localhost ([127.0.0.1]:56307 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ia5IS-00088t-Um
	for submit <at> debbugs.gnu.org; Wed, 27 Nov 2019 16:56:29 -0500
Received: from chocolate.birch.relay.mailchannels.net ([23.83.209.35]:62544)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1ia5IQ-00088k-Ca
 for 38354 <at> debbugs.gnu.org; Wed, 27 Nov 2019 16:56:27 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 37BF93C13F7;
 Wed, 27 Nov 2019 21:56:25 +0000 (UTC)
Received: from pdx1-sub0-mail-a94.g.dreamhost.com
 (100-96-15-77.trex.outbound.svc.cluster.local [100.96.15.77])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id 83E573C1311;
 Wed, 27 Nov 2019 21:56:24 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a94.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); Wed, 27 Nov 2019 21:56:25 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Rock-Troubled: 1d21e845767e2a2d_1574891785031_1556687824
X-MC-Loop-Signature: 1574891785031:3222463399
X-MC-Ingress-Time: 1574891785030
Received: from pdx1-sub0-mail-a94.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a94.g.dreamhost.com (Postfix) with ESMTP id 4496E9C453;
 Wed, 27 Nov 2019 13:56:19 -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=sFMoOEq0CaslygTkn9GCdcFEcYQ=; b=
 zqAJfg+2tnBLRmQO8DIGyRvSG6mnVmVEB7aWSF7YF5DAlc+xOp5QQ1xU8XUC+UlW
 y107SNmuPQxr4B17/6n3oRGqHxl0ZJPrg9dAIbpuW9f7dPGsk2ZmqpgwJcDz4NpR
 kzdJbMK2m7H9e6BUfOJdh0meXwa1kq5sU6LRMxSQbDg=
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@HIDDEN)
 by pdx1-sub0-mail-a94.g.dreamhost.com (Postfix) with ESMTPSA id 650A49C458;
 Wed, 27 Nov 2019 13:56:16 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a94
From: Juri Linkov <juri@HIDDEN>
To: martin rudalics <rudalics@HIDDEN>
Subject: Re: bug#38354: 27.0.50; Implement display action display-buffer-in-tab
Organization: LINKOV.NET
References: <87imna2nsi.fsf@HIDDEN>
 <cc86d5bd-76fd-7a70-71b7-caa9bb4ad3c6@HIDDEN>
 <8736ea5kcz.fsf@HIDDEN>
 <7979be54-2a01-2e97-d956-2500e7999e26@HIDDEN>
Date: Wed, 27 Nov 2019 23:37:48 +0200
In-Reply-To: <7979be54-2a01-2e97-d956-2500e7999e26@HIDDEN> (martin rudalics's
 message of "Wed, 27 Nov 2019 10:49:17 +0100")
Message-ID: <87d0dd3yb7.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38354
Cc: 38354 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>> display-buffer-in-tab is implemented now, but we need also an action
>> to display the buffer in an existing tab if such buffer is
>> already displayed in it.
>
> Could we please clarify the term "display(ed)" in this context.  IIUC
> you use it
>
> - to say that a buffer is part of a tab (a window configuration that
>   can be shown on a frame), and

In my code I use for this:

  (tab-bar-buffer-visible-in-tabs-p buffer)

> - to say that a buffer is actually displayed on a frame that has a
>   tab-bar.

In my code I use for this:

  (>= (length (get-buffer-window-list buffer t t)) 1)

i.e. I check these situations differently, and use 'or'
to combine these conditions:

  (or (>= (length (get-buffer-window-list buffer t t)) 1)
      (tab-bar-buffer-visible-in-tabs-p buffer))

Should these conditions be combined in one function
(if the current tab can be considered a tab as well)?

> Right?  Then the former should not use the term "display(ed)" but
> maybe something like "tab(bed)".  "Tab a buffer" would then mean to
> make sure that the buffer is part of a tab, "tabbed" that it is part
> of at least one tab.

Not sure if "tabbed" is the right word.  None of these definitions fits:
https://www.dictionary.com/browse/tabbed
https://www.urbandictionary.com/define.php?term=tabbed

>> This will require a new function function tab-bar-buffer-visible-in-tabs.
>
> What would "visible" precisely stand for here?

Maybe a better word is "has"?  Then the name would be tab-bar-has-buffer-in-tab.

> And why "tabs" indiscriminately?  Don't you ever want to check for
> presence or visibility in a specific tab only?

A specific tab referred by name?  Maybe such function could be useful as well.
But currently there is need for a function that returns a tab that has
the given buffer:

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 5eb332884c..7746c59f17 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1284,6 +1284,13 @@ display-buffer-in-tab
+(defun tab-bar-has-buffer-in-tab (buffer)
+  "Return a tab that has the buffer BUFFER."
+  (seq-some (lambda (tab)
+              (when (memq buffer (window-state-buffers (cdr (assq 'ws tab))))
+                tab))
+            (funcall tab-bar-tabs-function)))

>> I tried to copy an existing action
>> that supports frames, but can't find such a frame action that
>> would select another frame if the buffer is already is displayed in it.
>> Does such frame action exist whose behavior could be copied to tabs?
>
> 'display-buffer-reuse-window' together with 'reusable-frames' should
> have all the ingredients for this.  What is missing?

Than we need to add 'reusable-tabs'?

>> Also I use this function in a wrapper that kills the buffer, such wrapper checks
>>
>>    (tab-bar-buffer-visible-in-tabs-p (current-buffer))
>>
>> If true, it doesn't kill the buffer, but buries it.
>
> Via 'kill-buffer-query-functions'?

Rather calling it explicitly with a new commands, but it should be
possible to use 'kill-buffer-query-functions' too.

>> So switching back to that tab still displays the buffer.
>
> When I do 'kill-buffer', I expect that buffer to get removed from
> 'buffer-list' and all windows showing it, that it won't be switched to
> by many functions and so on.  Whatever we'd do, we have to manage this
> controversy somehow.  Think of changes or the deletion of the visited
> files.  How would we try to avoid saving such buffers to their files
> in that case?

A buffer can't be removed from saved window-configurations and window-states.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38354; Package emacs. Full text available.

Message received at 38354 <at> debbugs.gnu.org:


Received: (at 38354) by debbugs.gnu.org; 27 Nov 2019 09:49:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 27 04:49:30 2019
Received: from localhost ([127.0.0.1]:53449 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iZtww-0003YP-9p
	for submit <at> debbugs.gnu.org; Wed, 27 Nov 2019 04:49:30 -0500
Received: from mout.gmx.net ([212.227.15.15]:50351)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rudalics@HIDDEN>) id 1iZtwu-0003YA-7D
 for 38354 <at> debbugs.gnu.org; Wed, 27 Nov 2019 04:49:29 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1574848158;
 bh=/MdWraiEpZYW+Ru9l9D6hyhMwuKYXbbwiQqFof82/ss=;
 h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To;
 b=Q8BIfUw7T5Ymf8z5jaxQml5C0+IM85FtXc3tegSZyMBDvh0qtCTfHO+redYELKiiG
 JtT72S2/azifqt/JMUUwEdZxYkpELzOGhcZmePMyiRhC7y8pTasnEKJkoP6F6lCXbd
 yxF+I+K/tPTPRJ1yeNm3xVay1juJKwjRbCU1WiPE=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from [192.168.1.101] ([212.95.5.23]) by mail.gmx.com (mrgmx004
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MHXFr-1ied2t26HB-00DZCL; Wed, 27
 Nov 2019 10:49:18 +0100
Subject: Re: bug#38354: 27.0.50; Implement display action display-buffer-in-tab
To: Juri Linkov <juri@HIDDEN>
References: <87imna2nsi.fsf@HIDDEN>
 <cc86d5bd-76fd-7a70-71b7-caa9bb4ad3c6@HIDDEN>
 <8736ea5kcz.fsf@HIDDEN>
From: martin rudalics <rudalics@HIDDEN>
Message-ID: <7979be54-2a01-2e97-d956-2500e7999e26@HIDDEN>
Date: Wed, 27 Nov 2019 10:49:17 +0100
MIME-Version: 1.0
In-Reply-To: <8736ea5kcz.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: de-AT
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K1:UlOMSNOuoS0Rk8qHlUDTAqwfUCUbxldXMGrF6kJ72oQUHBUt82D
 2hBXhPjFoO4PLjalbNnaoHJC+SSO0U4cg/YV3vq4SBr0p1Anophi1WtDT9zs4CxdN2mOVJl
 2G68RfYF6wDjEJCaU5f/OVIWL93ke5epfH0aWcj6AdDLa9gMovYu9z+fRDTcXJ8JIARhfEN
 BxcGGM8DFix4Tl24CU2nw==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:5P4FkViLTJ8=:OwGvZXIxyreDJPraSxy5VW
 PouB23hKspewQsRlINeyhCSpF8vCRYog9kaJzFeTiK3wH5LiYbAVeOSGmCwuCA2A+Si9fUwsW
 jUcSEcZudnO+CSFrjnMuHC1X/iVS0h+vqMufOanB7Os6pRCW1NgWE/itSZg6/mBM5dKgor3AJ
 MoNPjv0szwVpgZN/sdY2KvQ7NuuS4ecokkOcHTI8ycMgI0SlIndredSfg/+ugBiI94zG2AYTT
 a/HegQ4h7oFNltiAK+x3D82EBs+ZANrG1lSLndPHiBEhiZ6o4rUaQ3CsMJW0bAtXsjq7RuBu8
 cz83PcbGUOdVlX1up5LApTZE9/KculX1AbQXmIbu4Sw54a90Mv1t5uTEiG6DKLSHTY1RBtycm
 KxEIcJUzATiPaR+HLZ/2FPCnOCeSmAJN2dl4a0QhLSjZI9OROso6yiHlfIV0ZlrqJU+WMZ4xc
 8P1U1WYmipmV3teA0pc/pR8p7IAzbqI8Bl5Sa7pOHzwv2FaG3fkvqM9MzLjb74MoawxYqLWel
 JVlO8kdmPvIHjus1DtCPyaGXx+5zvO9+Tjg/BiQ/Ro1xrp58PC664xAum6QzpZI6/14nvmbuS
 lwp65GeSsRwlfR/AQ8/BHNGlXrZ74HVf2VZHWZBe9IIkEJe281w482vKg4uAxYFVGue44elCH
 72dXnJ+qtjAN7lR5Y6g3/5pSme7vuL7wVl1TMlFwyS/t2+qlbfYLGcA96QpdylpL6x/Mge0pJ
 qRmuHqOEOkP22bHIQrJU7yu+PBRBgwczEMigo5pmBgdahsGXe6iXiyFXOFRLC6WZohypuv+FE
 fp1R48/3I5lGIq1ud7G0o8GMtieoT+gpeaZgbss/PxMXmtql2y4wiYJrtkSaZ2Pu7wNAoVFJP
 pYq9a4XJ8dvSdpw2XONJI0ljwI6YYZWu3oJba/h3+/T1w0qYoQcunKxsx6IxsHroQa6L1LZd0
 Hivt5BbrYbqgkxwoWZoyuegt3kUEU/A5AKX4+UOb+rc810NNbffZxDDZy2PfmIKL7m1UrTpKo
 gxmgvSFKwHvC2EdevH89+WZT7dwS3Y+L8tm+DcqKQ9w4IYaNX4AuywnPcopNEPo9NV1QsHNYg
 cp5HnzW/slz0Gcj8e7nh/RSIu9pfS3ChJ9ZaZNzjtW5vtM7uKNe9EJbBTEQDeBsYSwCCnJngq
 gCC7RPvo1f0qeopLBT513cwtu+Nqmc/58fszrEj1guSai6oKPTy8QW18bWwpSGSsR2jGG9zC7
 KfrGXUvME5R1cA0R/FNu1Jupq8xW3xezjZEHaNbFy+fywVmKu9GgyOPCkqxU=
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38354
Cc: 38354 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

 > display-buffer-in-tab is implemented now, but we need also an action
 > to display the buffer in an existing tab if such buffer is
 > already displayed in it.

Could we please clarify the term "display(ed)" in this context.  IIUC
you use it

- to say that a buffer is part of a tab (a window configuration that
   can be shown on a frame), and

- to say that a buffer is actually displayed on a frame that has a
   tab-bar.

Right?  Then the former should not use the term "display(ed)" but
maybe something like "tab(bed)".  "Tab a buffer" would then mean to
make sure that the buffer is part of a tab, "tabbed" that it is part
of at least one tab.

 > I tried to copy an existing action
 > that supports frames, but can't find such a frame action that
 > would select another frame if the buffer is already is displayed in it.
 > Does such frame action exist whose behavior could be copied to tabs?

'display-buffer-reuse-window' together with 'reusable-frames' should
have all the ingredients for this.  What is missing?

 > This will require a new function function tab-bar-buffer-visible-in-tabs.

What would "visible" precisely stand for here?  And why "tabs"
indiscriminately?  Don't you ever want to check for presence or
visibility in a specific tab only?

 > Also I use this function in a wrapper that kills the buffer, such wrapper checks
 >
 >    (tab-bar-buffer-visible-in-tabs-p (current-buffer))
 >
 > If true, it doesn't kill the buffer, but buries it.

Via 'kill-buffer-query-functions'?

 > So switching back to that tab still displays the buffer.

When I do 'kill-buffer', I expect that buffer to get removed from
'buffer-list' and all windows showing it, that it won't be switched to
by many functions and so on.  Whatever we'd do, we have to manage this
controversy somehow.  Think of changes or the deletion of the visited
files.  How would we try to avoid saving such buffers to their files
in that case?

martin




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38354; Package emacs. Full text available.

Message received at 38354 <at> debbugs.gnu.org:


Received: (at 38354) by debbugs.gnu.org; 26 Nov 2019 22:57:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 26 17:57:06 2019
Received: from localhost ([127.0.0.1]:53148 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iZjlZ-0007kp-Ns
	for submit <at> debbugs.gnu.org; Tue, 26 Nov 2019 17:57:06 -0500
Received: from dragonfly.birch.relay.mailchannels.net ([23.83.209.51]:29785)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1iZjlX-0007kg-Ja
 for 38354 <at> debbugs.gnu.org; Tue, 26 Nov 2019 17:57:04 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 1D9AB3C0C2E;
 Tue, 26 Nov 2019 22:57:02 +0000 (UTC)
Received: from pdx1-sub0-mail-a82.g.dreamhost.com
 (100-96-4-107.trex.outbound.svc.cluster.local [100.96.4.107])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id 891FE3C0B25;
 Tue, 26 Nov 2019 22:57:01 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a82.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); Tue, 26 Nov 2019 22:57:02 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Eight-Robust: 53fbbda90a647539_1574809021801_2780614693
X-MC-Loop-Signature: 1574809021801:525596005
X-MC-Ingress-Time: 1574809021801
Received: from pdx1-sub0-mail-a82.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a82.g.dreamhost.com (Postfix) with ESMTP id 454947F1C8;
 Tue, 26 Nov 2019 14:56:56 -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=gFoRAT2ZHMcaDUlTozzO5nYvetw=; b=
 RMFJYwxab1jy8gD66OVJ41eVIISMHMQ6jbKkVJk9/6y0ZbpGu79WBnuN13uQfNUg
 fLtJ81XX4skm5o2JLbZN5bInMWt06uoyIXiZylqUPE/BJXtbS3r2FcP1CHPfoX3x
 0aH+4RqmXDM8cFGi3nbAgRspiHaMdywWaWPbG2/LXOc=
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@HIDDEN)
 by pdx1-sub0-mail-a82.g.dreamhost.com (Postfix) with ESMTPSA id A56CD7F1D1;
 Tue, 26 Nov 2019 14:56:54 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a82
From: Juri Linkov <juri@HIDDEN>
To: martin rudalics <rudalics@HIDDEN>
Subject: Re: bug#38354: 27.0.50; Implement display action display-buffer-in-tab
Organization: LINKOV.NET
References: <87imna2nsi.fsf@HIDDEN>
 <cc86d5bd-76fd-7a70-71b7-caa9bb4ad3c6@HIDDEN>
Date: Wed, 27 Nov 2019 00:43:56 +0200
In-Reply-To: <cc86d5bd-76fd-7a70-71b7-caa9bb4ad3c6@HIDDEN> (martin rudalics's
 message of "Tue, 26 Nov 2019 10:32:21 +0100")
Message-ID: <8736ea5kcz.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38354
Cc: 38354 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

>> The only problem is that I don't know how to use matched numbered groups
>> \1 from matches of buffer names in display conditions.
>>
>> display-buffer-assq-regexp uses string-match-p, not string-match.
>
> If you really need 'string-match', we have to save the match data.

display-buffer-in-tab is implemented now, but we need also an action
to display the buffer in an existing tab if such buffer is
already displayed in it.  I tried to copy an existing action
that supports frames, but can't find such a frame action that
would select another frame if the buffer is already is displayed in it.
Does such frame action exist whose behavior could be copied to tabs?

This will require a new function function tab-bar-buffer-visible-in-tabs.

Also I use this function in a wrapper that kills the buffer, such wrapper checks

  (tab-bar-buffer-visible-in-tabs-p (current-buffer))

If true, it doesn't kill the buffer, but buries it.
So switching back to that tab still displays the buffer.

Another place where I use tab-bar-buffer-visible-in-tabs-p
is to save Dired buffers to the desktop file only
when the Dired buffer is displayed in a tab:

  (setq desktop-buffers-not-to-save-function
        (lambda (_filename bufname mode &rest _)
          (or (not (memq mode '(dired-mode vc-dir-mode)))
              (memq (get-buffer bufname) (mapcar #'window-buffer (window-list-1)))
              (tab-bar-buffer-visible-in-tabs-p (get-buffer bufname)))))

This also required changes in desktop.el to support new predicate function
desktop-buffers-not-to-save-function.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=tab-bar-buffer-visible-in-tabs-p.patch

diff --git a/lisp/window.el b/lisp/window.el
index c750ea71ea..b46abd6ced 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -6231,6 +6231,17 @@ window-state-put
 	    (delete-window window))))
       (window--check frame))))
 
+(defun window-state-buffers (state)
+  "Return all buffers saved to the given window state STATE."
+  (let ((buffer (cadr (assq 'buffer state)))
+        (buffers (mapcan (lambda (item)
+                           (when (memq (car item) '(leaf vc hc))
+                             (window-state-buffers item)))
+                         (if (consp (car state)) (list (cdr state)) (cdr state)))))
+    (if buffer
+        (cons (get-buffer buffer) buffers)
+      buffers)))
+
 (defun window-swap-states (&optional window-1 window-2 size)
   "Swap the states of live windows WINDOW-1 and WINDOW-2.
 WINDOW-1 must specify a live window and defaults to the selected
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 5eb332884c..9c8c38fb83 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1284,6 +1284,12 @@ display-buffer-in-tab
               (tab-bar-rename-tab name))))
       (tab-bar-new-tab))))
 
+(defun tab-bar-buffer-visible-in-tabs-p (buffer)
+  "Return non-nil when BUFFER is visible in other tabs."
+  (seq-some (lambda (tab)
+              (memq buffer (window-state-buffers (cdr (assq 'ws tab)))))
+            (funcall tab-bar-tabs-function)))
+
 
 (defun switch-to-buffer-other-tab (buffer-or-name &optional norecord)
   "Switch to buffer BUFFER-OR-NAME in another tab.
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 498f769bd3..6f45278218 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -946,7 +946,9 @@ desktop-outvar
 	      ")\n"))))
 
 ;; ----------------------------------------------------------------------------
-(defun desktop-save-buffer-p (filename bufname mode &rest _dummy)
+(defvar desktop-buffers-not-to-save-function nil)
+
+(defun desktop-save-buffer-p (filename bufname mode &rest rest)
   "Return t if buffer should have its state saved in the desktop file.
 FILENAME is the visited file name, BUFNAME is the buffer name, and
 MODE is the major mode.
@@ -970,6 +972,9 @@ desktop-save-buffer-p
 	     (and (null filename)
 		  (null dired-skip)  ; bug#5755
 		  (with-current-buffer bufname desktop-save-buffer)))
+	 (or (null desktop-buffers-not-to-save-function)
+	     (funcall desktop-buffers-not-to-save-function
+		      filename bufname mode rest))
 	 t)))
 
 ;; ----------------------------------------------------------------------------

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38354; Package emacs. Full text available.

Message received at 38354 <at> debbugs.gnu.org:


Received: (at 38354) by debbugs.gnu.org; 26 Nov 2019 22:32:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 26 17:32:18 2019
Received: from localhost ([127.0.0.1]:53137 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iZjNa-00079f-E2
	for submit <at> debbugs.gnu.org; Tue, 26 Nov 2019 17:32:18 -0500
Received: from antelope.elm.relay.mailchannels.net ([23.83.212.4]:9962)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1iZjNZ-00079X-Be
 for 38354 <at> debbugs.gnu.org; Tue, 26 Nov 2019 17:32:17 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 279FC3C0DB0;
 Tue, 26 Nov 2019 22:32:16 +0000 (UTC)
Received: from pdx1-sub0-mail-a7.g.dreamhost.com
 (100-96-4-107.trex.outbound.svc.cluster.local [100.96.4.107])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id 992563C0DE9;
 Tue, 26 Nov 2019 22:32:15 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a7.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); Tue, 26 Nov 2019 22:32:16 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Left-Company: 0e67baa47f35bafc_1574807535853_632401268
X-MC-Loop-Signature: 1574807535853:1320644164
X-MC-Ingress-Time: 1574807535853
Received: from pdx1-sub0-mail-a7.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a7.g.dreamhost.com (Postfix) with ESMTP id 3DEB6847B6;
 Tue, 26 Nov 2019 14:32:10 -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=oUYOyB9+vwP1tkkCBz+Hn8+o4x0=; b=
 t6RQz6CKaZtcg9K4xyB52YRqjUhq1WWB2OEt4mKhZvN1R4xocAAYJqS+DBOEOjfX
 u5jU3Nnyqt3pCHrptZQOGgFmtkpEenyCpEVIC+zIB0qfcZAe7C9QWdWN/YgMi6BF
 oLvz3dq83CGvOZ0trlnhDa696IPIAEHGH/4ANto+m8o=
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@HIDDEN)
 by pdx1-sub0-mail-a7.g.dreamhost.com (Postfix) with ESMTPSA id 1CCC1847C0;
 Tue, 26 Nov 2019 14:32:07 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a7
From: Juri Linkov <juri@HIDDEN>
To: martin rudalics <rudalics@HIDDEN>
Subject: Re: bug#38354: 27.0.50; Implement display action display-buffer-in-tab
Organization: LINKOV.NET
References: <87imna2nsi.fsf@HIDDEN>
 <cc86d5bd-76fd-7a70-71b7-caa9bb4ad3c6@HIDDEN>
Date: Wed, 27 Nov 2019 00:30:12 +0200
In-Reply-To: <cc86d5bd-76fd-7a70-71b7-caa9bb4ad3c6@HIDDEN> (martin rudalics's
 message of "Tue, 26 Nov 2019 10:32:21 +0100")
Message-ID: <87lfs26zkb.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38354
Cc: 38354 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>> The only problem is that I don't know how to use matched numbered groups
>> \1 from matches of buffer names in display conditions.
>>
>> display-buffer-assq-regexp uses string-match-p, not string-match.
>
> If you really need 'string-match', we have to save the match data.

This is implemented now by using a lambda for tab name (the last example).
Examples:

1. open the buffer test1 in a new tab

  (push '("\\`test1\\'" .
          (display-buffer-in-tab))
        display-buffer-alist)

2. open the buffer test2 in a new tab with the explicit name "Tab test2"

  (push '("\\`test2\\'" .
          (display-buffer-in-tab
           (name . "Tab test2")))
        display-buffer-alist)

3. open the buffer test3 in a new tab with the explicit name constructed
   from the buffer name:

  (push '("\\`test3\\'" .
          (display-buffer-in-tab
           (name . (lambda (buffer _alist)
                     (format "[%s]" buffer)))))
        display-buffer-alist)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38354; Package emacs. Full text available.

Message received at 38354 <at> debbugs.gnu.org:


Received: (at 38354) by debbugs.gnu.org; 26 Nov 2019 09:32:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 26 04:32:30 2019
Received: from localhost ([127.0.0.1]:50206 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iZXCw-0006SE-Cj
	for submit <at> debbugs.gnu.org; Tue, 26 Nov 2019 04:32:30 -0500
Received: from mout.gmx.net ([212.227.15.18]:39223)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rudalics@HIDDEN>) id 1iZXCu-0006Ru-GK
 for 38354 <at> debbugs.gnu.org; Tue, 26 Nov 2019 04:32:28 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1574760740;
 bh=KeMVCBvlby/pdPbtAIOxQZHzlwJmOOpOQwk56s5q5q8=;
 h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To;
 b=IZ8ZXAdvnYF9VLOf4P3yQQgHejT42vyXgylwAahGX4Cgb1XPixWCTLAuCD5VZK6ck
 D4PwpNY/d2tuEKcrtKU9ZnveqRTrfBXBI8oKUQlaeV4JasLeyd9Bt2Dae+6f6DXFRc
 0olRQc6EVEIu4CUuzD16S6AzmFQePOSHVTL57NPA=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from [192.168.1.101] ([46.125.249.28]) by mail.gmx.com (mrgmx004
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MLzFr-1iI8oM3N8D-00Huf8; Tue, 26
 Nov 2019 10:32:19 +0100
Subject: Re: bug#38354: 27.0.50; Implement display action display-buffer-in-tab
To: Juri Linkov <juri@HIDDEN>, 38354 <at> debbugs.gnu.org
References: <87imna2nsi.fsf@HIDDEN>
From: martin rudalics <rudalics@HIDDEN>
Message-ID: <cc86d5bd-76fd-7a70-71b7-caa9bb4ad3c6@HIDDEN>
Date: Tue, 26 Nov 2019 10:32:21 +0100
MIME-Version: 1.0
In-Reply-To: <87imna2nsi.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: de-AT
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K1:SGZHmCfP5eMIk4Aj4lEvepFdaebs5TpE0g3g3rNJXJn+YpGxykg
 yJccYe0i+F2kfOcYP80uPM1rq3NLrkD+Njq41kY5m7gzWfq5Shi+Q1KBk3GNzSC0WWh9ol2
 hXLhFr02Ux7Gxm5dKDkuE271AUR2N92Y76uadeMudSALRLunuZwIMPaV4BWWoCMhbswMmqV
 dupqdYPuTWQq+sWIK96LA==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:Hezw+278v2c=:OZA/xDVjv13mihTn5BnAIR
 pQipEeQWd3l8PGQDJNESIJ2ngVmPpRCziJUtbyi9tAboZ1+3KzBmwhbPXO86DpWe055NB/PHy
 g2u8OwV88So/lpauu/MEgubmUzgznHKOJ9V1XgDPfO+kJQ4fqBKv4IpctxzyrDb7tlC88rqWG
 Wfe46HvVOYg1q1UCVlHmOs5lqxzZKFHADuWShkxVMafxHMXDVcSxItg6VqtsRWpkAFRGO3GS8
 VhBR50lBhp9p2yIoq/qAUVZO5J4/oT/9VTzokF+kW7JVmyMZrpJdp5X+wYJ9J4Q5mC90+20HV
 2lpkM/UPl34cnTSvCgCxz47XxdHXBGUhPtKb3zEzlqe6ZEWTCEbzycEw44PhlOzwd6woM1jE4
 9KiDzBaLPocCGj9iXcqCU5hZbeZz3y6oTr6oXAOwahnM1OXY/azKwHyWfMHajUcy/KZNXJKhC
 7eAcUqm0LlIDSbQbHENEkFNalqDQENqWbKzdNHq5c9D5LaKngiKzBVx0jVocF1sJmsf6JgBE3
 69CSyGOcycx0j2Ngcf/h5jH5d/u02EzUaDkxERrZzoA1jx2DITBGqAulMaYG2ueL5Yfyglxtq
 8Dab0NsSLTZ7ozAFuQppLCNryZeaoRv24FENgAVCKFyh4auGS1yxDr0NxLDtcCcy7GceEBaps
 MhCfd1qE/ewqR8fnS1LREE8ioKTpXYAvocRGHe5H6gp5y9lJaylyRoYyHo/5pdgpmbVIQOxmp
 8NYJ6c01nVag01MKyEfDlsv/Q6U8fA884OtyxBl+uuOKdk8Pj2lQ1xmj1T9N15EWbtjbV88ON
 dybvuWlJv6z7JznPVcYp2TTWcACcV1fHcp/J/NjhxrrJDznGSyCm8DIgjGOt5mIVTVhQvbMt4
 VWR/IfZagNEl8ePswSrpC3St0IZ5L6MgGu7CDQ7NKeaIMfM8RpZ0wjowcPu7bORlXI02cN8Tp
 XkWvFnhl5skUxVAqxAN1p2snSxuDu1YT+QV1j3Xrbq9hbdD8D3rae5XFqJYKYdNlT+y1WWMnz
 41d7FRcbmS+eLzKdP02kaczsYeKQg8s37gSlMg+rVkNfthY9uXS7u0sxPouJStMB5LVKkOrva
 tS+vTW8Dwbx2VIZBTONiBzrPvqXTrWbl2aBoIq8Are4Fyh5iHo+FKFN0cm84WfKMotQ0mniWo
 VWxydBIWZXvpWMzQp5IDGeqQzAwUSOxFypdNEtatMPuffGbZTiiWWa//DkC3iGhzwGb9H0dAf
 pEx+/aTss1olOrYGKR6sHvLtGLoUeW5GCgdjwFj/dbJbssWVjuILpU4hWG8Q=
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38354
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

 > The only problem is that I don't know how to use matched numbered groups
 > \1 from matches of buffer names in display conditions.
 >
 > display-buffer-assq-regexp uses string-match-p, not string-match.

If you really need 'string-match', we have to save the match data.

martin




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38354; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 23 Nov 2019 23:10:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 23 18:10:46 2019
Received: from localhost ([127.0.0.1]:57948 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iYeY7-0007Mw-I1
	for submit <at> debbugs.gnu.org; Sat, 23 Nov 2019 18:10:46 -0500
Received: from lists.gnu.org ([209.51.188.17]:58410)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1iYeXy-0007Mf-MO
 for submit <at> debbugs.gnu.org; Sat, 23 Nov 2019 18:10:37 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:35983)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <juri@HIDDEN>) id 1iYeXx-0000H2-GR
 for bug-gnu-emacs@HIDDEN; Sat, 23 Nov 2019 18:10:34 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_NONE,
 URIBL_BLOCKED autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <juri@HIDDEN>) id 1iYeXw-0007IW-Ab
 for bug-gnu-emacs@HIDDEN; Sat, 23 Nov 2019 18:10:33 -0500
Received: from aye.elm.relay.mailchannels.net ([23.83.212.6]:27782)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <juri@HIDDEN>) id 1iYeXv-0007IC-Sd
 for bug-gnu-emacs@HIDDEN; Sat, 23 Nov 2019 18:10:32 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 33E892C14A5
 for <bug-gnu-emacs@HIDDEN>; Sat, 23 Nov 2019 23:10:30 +0000 (UTC)
Received: from pdx1-sub0-mail-a5.g.dreamhost.com
 (100-96-83-20.trex.outbound.svc.cluster.local [100.96.83.20])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id BE9AB2C135A
 for <bug-gnu-emacs@HIDDEN>; Sat, 23 Nov 2019 23:10:29 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a5.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); Sat, 23 Nov 2019 23:10:30 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Little-Befitting: 4359630433f7befc_1574550629982_3524264304
X-MC-Loop-Signature: 1574550629982:2583756555
X-MC-Ingress-Time: 1574550629981
Received: from pdx1-sub0-mail-a5.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a5.g.dreamhost.com (Postfix) with ESMTP id 8287F83E47
 for <bug-gnu-emacs@HIDDEN>; Sat, 23 Nov 2019 15:10:27 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to
 :subject:date:message-id:mime-version:content-type; s=
 linkov.net; bh=VJ17CFrLroaU/j627aXXkpBJZwY=; b=afCG2YqZFHA4aG7tB
 aLVZ6/j05WuZey1qVxuO+GUdCtq55xDkjITlRwtLpQ5JFgOtgeueu1IeGAvwIYYN
 IOajxOFelmORxHfNLz2HpJx7+9jGvmmcdAPFNppOEiPM8m/nNunI7LFSnWva+a5L
 icWXtu7DmQ22TfgAK5Hw2w75PE=
Received: from mail.jurta.org (m91-129-105-73.cust.tele2.ee [91.129.105.73])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 (Authenticated sender: jurta@HIDDEN)
 by pdx1-sub0-mail-a5.g.dreamhost.com (Postfix) with ESMTPSA id 5EC0783E50
 for <bug-gnu-emacs@HIDDEN>; Sat, 23 Nov 2019 15:10:25 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a5
From: Juri Linkov <juri@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 27.0.50; Implement display action display-buffer-in-tab
Organization: LINKOV.NET
Date: Sun, 24 Nov 2019 01:09:01 +0200
Message-ID: <87imna2nsi.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-Received-From: 23.83.212.6
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

Severity: wishlist

Like demonstrated in bug#37998 we need a new display action
display-buffer-in-tab to use in display-buffer-alist.  Examples:

  ("\\`\\*Group\\*\\'" .
   (display-buffer-in-tab
    (name . "Gnus")))

  ("\\`\\*Summary \\(.*\\)\\*\\'" .
   (display-buffer-in-tab
    (name . "Group \\1")))

The only problem is that I don't know how to use matched numbered groups
\1 from matches of buffer names in display conditions.

display-buffer-assq-regexp uses string-match-p, not string-match.




Acknowledgement sent to Juri Linkov <juri@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#38354; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 28 Nov 2019 09:30:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.