all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Bastian Beranek <bastian.beischer@gmail.com>
To: Juri Linkov <juri@linkov.net>
Cc: 46299@debbugs.gnu.org
Subject: bug#46299: 28.0.50; Value of tab-bar-show not respected in new frames.
Date: Sat, 6 Feb 2021 13:16:54 +0100	[thread overview]
Message-ID: <CAK9AuB-J8U8Q4YCLjvmHmcEz06bZP3GxKEToTnWgqxtm8QdFzA@mail.gmail.com> (raw)
In-Reply-To: <CAK9AuB9KfD_b_g2k7HO9gTyXt0==Uje081CmzXLGbT95rCY_0Q@mail.gmail.com>

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

Hello Juri,

I added code to make the frame setting of tab-bar-lines as well as the
default-frame-alist value dependent on tab-bar-show to the
tab-bar-mode function.
I think with this the part to which sets frame parameters in
tab-bar-show :set is not needed because (tab-bar-mode 1) is called
anyway, which already does everything.

What do you think about the attached patch?

Cheers
Bastian

On Fri, Feb 5, 2021 at 3:11 PM Bastian Beranek
<bastian.beischer@gmail.com> wrote:
>
> Hello Juri,
>
> I now installed your patch and I don't think it is complete yet.
>
> 1) Is the :set function actually used the next time emacs starts after
> customizations have been written to .emacs and variables are
> initialized to customized values using (custom-set-variables ...)? I
> don't think it is, right?
>
> 2) Switching tab-bar-mode on and off seems to overwrite the
> tab-bar-lines information in default-frame-alist:
>
>     ;; If the user has given `default-frame-alist' a `tab-bar-lines'
>     ;; parameter, replace it.
>     (if (assq 'tab-bar-lines default-frame-alist)
>         (setq default-frame-alist
>               (cons (cons 'tab-bar-lines val)
>                     (assq-delete-all 'tab-bar-lines
>                                      default-frame-alist)))))
>
> This code should depend on the value of tab-bar-show, right?
>
> Cheers
> Bastian

[-- Attachment #2: tab-bar.patch --]
[-- Type: text/x-patch, Size: 2183 bytes --]

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 6720d82b47..1741173bbe 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -139,16 +139,21 @@ Possible modifier keys are `control', `meta', `shift', `hyper', `super' and
   :global t
   ;; It's defined in C/cus-start, this stops the d-m-m macro defining it again.
   :variable tab-bar-mode
-  (let ((val (if tab-bar-mode 1 0)))
+
+  ;; Set frame parameters.
+  (let ((defaultval (if (and tab-bar-mode tab-bar-show) 1 0)))
     (dolist (frame (frame-list))
-      (set-frame-parameter frame 'tab-bar-lines val))
-    ;; If the user has given `default-frame-alist' a `tab-bar-lines'
-    ;; parameter, replace it.
-    (if (assq 'tab-bar-lines default-frame-alist)
-        (setq default-frame-alist
-              (cons (cons 'tab-bar-lines val)
-                    (assq-delete-all 'tab-bar-lines
-                                     default-frame-alist)))))
+      (let ((frameval (if (natnump tab-bar-show)
+                          (if (and defaultval
+                                   (> (length (funcall tab-bar-tabs-function frame)) tab-bar-show))
+                              1 0)
+                        defaultval)))
+        (set-frame-parameter frame 'tab-bar-lines frameval)))
+    (let ((newframeval (if (and defaultval (eq tab-bar-show t)) 1 0)))
+      (setq default-frame-alist
+            (cons (cons 'tab-bar-lines newframeval)
+                  (assq-delete-all 'tab-bar-lines default-frame-alist)))))
+
   (when tab-bar-mode
     (tab-bar--load-buttons))
   (if tab-bar-mode
@@ -251,16 +256,7 @@ you can use the command `toggle-frame-tab-bar'."
   :set (lambda (sym val)
          (set-default sym val)
          ;; Preload button images
-         (tab-bar-mode 1)
-         ;; Then handle each frame individually
-         (dolist (frame (frame-list))
-           (set-frame-parameter
-            frame 'tab-bar-lines
-            (if (or (eq val t)
-                    (and (natnump val)
-                         (> (length (funcall tab-bar-tabs-function frame))
-                            val)))
-                1 0))))
+         (tab-bar-mode 1))
   :group 'tab-bar
   :version "27.1")
 

  reply	other threads:[~2021-02-06 12:16 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04 16:14 bug#46299: 28.0.50; Value of tab-bar-show not respected in new frames Bastian Beischer
2021-02-05  8:54 ` Juri Linkov
2021-02-05 10:10   ` Bastian Beranek
2021-02-05 14:11     ` Bastian Beranek
2021-02-06 12:16       ` Bastian Beranek [this message]
2021-02-07 19:05         ` Juri Linkov
2021-02-07 23:03           ` Bastian Beranek
2021-02-08 17:50             ` Bastian Beranek
2021-02-08 18:19               ` Juri Linkov
2021-02-08 19:04                 ` Bastian Beranek
2021-02-09  8:00                   ` martin rudalics
2021-02-09  8:15                     ` Bastian Beranek
2021-02-09  8:58                       ` martin rudalics
2021-02-09  9:23                         ` Bastian Beranek
2021-02-09  9:45                           ` martin rudalics
2021-02-09 11:44                             ` Bastian Beranek
2021-02-09 17:32                               ` martin rudalics
2021-02-09 18:06                               ` Juri Linkov
2021-02-09 18:46                                 ` Bastian Beranek
2021-02-09 19:08                                   ` Eli Zaretskii
2021-02-09 19:01                                 ` Eli Zaretskii
2021-02-10 18:24                               ` Juri Linkov
2021-02-11 12:14                                 ` Bastian Beranek
2021-02-11 17:34                                   ` Bastian Beranek
2021-02-12  9:31                                   ` Juri Linkov
2021-02-12 10:24                                     ` Bastian Beranek
2021-02-12 14:47                                       ` Bastian Beranek
2021-02-12 19:23                                         ` Bastian Beranek
2021-02-13 18:23                                           ` Juri Linkov
2021-02-13 19:02                                             ` Bastian Beranek
2021-02-13 19:46                                               ` Juri Linkov
2021-02-14 18:44                                                 ` Juri Linkov
2021-02-15 10:05                                                   ` Bastian Beranek
2021-02-15 15:26                                                   ` Eli Zaretskii
2021-02-15 15:32                                                     ` Bastian Beranek
2021-02-15 15:53                                                       ` Eli Zaretskii
2021-02-16 10:40                                                         ` Bastian Beranek
2021-02-14 13:08                                             ` Bastian Beranek
2021-02-14 18:50                                               ` Juri Linkov
2021-02-14 19:28                                                 ` Juri Linkov
2021-02-15  8:16                                                 ` martin rudalics
2021-02-15  9:07                                                   ` Juri Linkov
2021-02-15 10:08                                                     ` martin rudalics
2021-02-15 10:12                                                   ` Bastian Beranek
2021-02-15 10:09                                                 ` Bastian Beranek
2021-02-15 17:01                                                   ` Juri Linkov
2021-02-15 22:10                                                     ` Bastian Beranek
2021-02-16  2:08                                                       ` bug#46299: [External] : " Drew Adams
2021-02-16 10:59                                                       ` Bastian Beranek
2021-02-16 15:31                                                         ` Bastian Beranek
2021-02-16 17:28                                                           ` Juri Linkov
2021-02-24 18:46                                                             ` Juri Linkov
2021-02-10 18:20                       ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK9AuB-J8U8Q4YCLjvmHmcEz06bZP3GxKEToTnWgqxtm8QdFzA@mail.gmail.com \
    --to=bastian.beischer@gmail.com \
    --cc=46299@debbugs.gnu.org \
    --cc=juri@linkov.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.