unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Address issue with tab-bar
@ 2020-09-17 15:33 James N V Cash
  2020-09-17 19:07 ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: James N V Cash @ 2020-09-17 15:33 UTC (permalink / raw)
  To: emacs-devel

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


I've noticed an issue where, if tab-bar-mode is t, but tab-bar-show is
1, then if you open a second tab, then close it, it will hide the tab
bar and not show it again.

e.g. running the following code will result in two tabs being open, but
the tab bar not visible.

(customize-set-variable 'tab-bar-show 1)
(tab-bar-mode)
(tab-bar-new-tab)
(tab-bar-close-tab)
(tab-bar-new-tab)

The below patch addresses this issue by not hiding the tab bar if
tab-bar-mode is t, in the same way that tab-bar-new-tab-to does.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix tab bar hiding --]
[-- Type: text/x-diff, Size: 599 bytes --]

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index d8f932e7a4..34a9188d85 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -940,7 +940,8 @@ tab-bar-close-tab
                 tab-bar-closed-tabs)
           (set-frame-parameter nil 'tabs (delq close-tab tabs)))
 
-        (when (and (not (zerop (frame-parameter nil 'tab-bar-lines)))
+        (when (and (not tab-bar-mode)
+                   (not (zerop (frame-parameter nil 'tab-bar-lines)))
                    (natnump tab-bar-show)
                    (<= (length (funcall tab-bar-tabs-function))
                        tab-bar-show))

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

* Re: [PATCH] Address issue with tab-bar
  2020-09-17 15:33 [PATCH] Address issue with tab-bar James N V Cash
@ 2020-09-17 19:07 ` Juri Linkov
  2020-09-17 20:12   ` James N. V. Cash
  0 siblings, 1 reply; 4+ messages in thread
From: Juri Linkov @ 2020-09-17 19:07 UTC (permalink / raw)
  To: James N V Cash; +Cc: emacs-devel

> I've noticed an issue where, if tab-bar-mode is t, but tab-bar-show is
> 1, then if you open a second tab, then close it, it will hide the tab
> bar and not show it again.
>
> e.g. running the following code will result in two tabs being open, but
> the tab bar not visible.
>
> (customize-set-variable 'tab-bar-show 1)
> (tab-bar-mode)
> (tab-bar-new-tab)
> (tab-bar-close-tab)
> (tab-bar-new-tab)
>
> The below patch addresses this issue by not hiding the tab bar if
> tab-bar-mode is t, in the same way that tab-bar-new-tab-to does.

But according to the documentation of 'tab-bar-show':

  "If the value is ‘1’, then hide the tab bar when it has only one tab,
  and show it again once more tabs are created."

tab-bar-close-tab should hide the tab-bar on the selected frame
with only one tab.

So the problem is that tab-bar-new-tab doesn't show the tab-bar again
when there are more than one tab.

It seems this is a consequence of bug#42052 that tried to implement
frame-local tab-bar where tab-bar-mode is always true, but it shows/hides
frame-local tab-bars depending on the frame-parameter 'tab-bar-lines'.



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

* Re: [PATCH] Address issue with tab-bar
  2020-09-17 19:07 ` Juri Linkov
@ 2020-09-17 20:12   ` James N. V. Cash
  2020-09-18  8:29     ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: James N. V. Cash @ 2020-09-17 20:12 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel

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


Juri Linkov <juri@linkov.net> writes:

> But according to the documentation of 'tab-bar-show':
>
>   "If the value is =E2=80=981=E2=80=99, then hide the tab bar when it has=
 only one tab,
>   and show it again once more tabs are created."
>
> tab-bar-close-tab should hide the tab-bar on the selected frame
> with only one tab.
>
> So the problem is that tab-bar-new-tab doesn't show the tab-bar again
> when there are more than one tab.

Ah, in that case, I think we can just remove the first case in the cond
in tab-bar-new-tab-to; simple patch attached

> It seems this is a consequence of bug#42052 that tried to implement
> frame-local tab-bar where tab-bar-mode is always true, but it shows/hides
> frame-local tab-bars depending on the frame-parameter 'tab-bar-lines'.

(I think that was me, whoops)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Fix tabs not reappearing --]
[-- Type: text/x-diff, Size: 336 bytes --]

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index d8f932e7a4..e4b3c8cf19 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -801,7 +801,6 @@ tab-bar-new-tab-to
                           (nth to-index tabs)))
 
     (cond
-     (tab-bar-mode)
      ((eq tab-bar-show t)
       (tab-bar-mode 1))
      ((and (natnump tab-bar-show)

[-- Attachment #3: Type: text/plain, Size: 78 bytes --]


P.S. Juri, sorry for the double-send, I forgot to CC the list the first time

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

* Re: [PATCH] Address issue with tab-bar
  2020-09-17 20:12   ` James N. V. Cash
@ 2020-09-18  8:29     ` Juri Linkov
  0 siblings, 0 replies; 4+ messages in thread
From: Juri Linkov @ 2020-09-18  8:29 UTC (permalink / raw)
  To: James N. V. Cash; +Cc: emacs-devel

>> So the problem is that tab-bar-new-tab doesn't show the tab-bar again
>> when there are more than one tab.
>
> Ah, in that case, I think we can just remove the first case in the cond
> in tab-bar-new-tab-to; simple patch attached
>
> diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
> index d8f932e7a4..e4b3c8cf19 100644
> --- a/lisp/tab-bar.el
> +++ b/lisp/tab-bar.el
> @@ -801,7 +801,6 @@ tab-bar-new-tab-to
>                            (nth to-index tabs)))
>
>      (cond
> -     (tab-bar-mode)
>       ((eq tab-bar-show t)
>        (tab-bar-mode 1))
>       ((and (natnump tab-bar-show)

Thanks for the fix, now pushed.



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

end of thread, other threads:[~2020-09-18  8:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17 15:33 [PATCH] Address issue with tab-bar James N V Cash
2020-09-17 19:07 ` Juri Linkov
2020-09-17 20:12   ` James N. V. Cash
2020-09-18  8:29     ` Juri Linkov

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).