all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Gabriel <gabriel376@hotmail.com>
To: 60073@debbugs.gnu.org
Subject: bug#60073: 30.0.50; [PATCH] Tab bar group format not applied to current
Date: Thu, 15 Dec 2022 12:04:42 -0300	[thread overview]
Message-ID: <PH8PR19MB70703CA4706A7F995ADA1AED8BE19@PH8PR19MB7070.namprd19.prod.outlook.com> (raw)
In-Reply-To: <PH8PR19MB7070310B60AFEF560BBFB61F8BE09@PH8PR19MB7070.namprd19.prod.outlook.com> (Gabriel's message of "Wed, 14 Dec 2022 17:16:24 -0300")

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

Here is a new patch that also updates the function
'tab-bar-tab-group-format-default'.  There are no breaking or functional
changes in how the tab-bar behaves today.

With this patch, the 'tab-bar-tab-group-format-function' behaves
similarly to 'tab-bar-tab-name-format-function'.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-tab-bar-tab-group-format-function-also-handle-c.patch --]
[-- Type: text/x-diff, Size: 2615 bytes --]

From 832e6ca6a5ce314e37a840356828c50adb94ebf4 Mon Sep 17 00:00:00 2001
From: Gabriel do Nascimento Ribeiro <gabriel376@hotmail.com>
Date: Thu, 15 Dec 2022 11:58:30 -0300
Subject: [PATCH 1/1] Make tab-bar-tab-group-format-function also handle
 current group

* lisp/tab-bar.el (tab-bar--format-tab-group): Call
'tab-bar-tab-group-format-default' to format current group tab.
(tab-bar-tab-group-format-default): Update function to also handle
current group tab.
---
 lisp/tab-bar.el | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 162e63fe23..1f25ee6d7e 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -844,8 +844,9 @@ tab-bar-tab-group-default
 
 (defcustom tab-bar-tab-group-format-function #'tab-bar-tab-group-format-default
   "Function to format a tab group name.
-Function gets two arguments, a tab with a group name and its number,
-and should return the formatted tab group name to display in the tab bar."
+Function gets three arguments, a tab with a group name, its
+number and an optional t when the tab is current, and should
+return the formatted tab group name to display in the tab bar."
   :type 'function
   :initialize 'custom-initialize-default
   :set (lambda (sym val)
@@ -854,11 +855,13 @@ tab-bar-tab-group-format-function
   :group 'tab-bar
   :version "28.1")
 
-(defun tab-bar-tab-group-format-default (tab i)
-  (propertize
-   (concat (if tab-bar-tab-hints (format "%d " i) "")
-           (funcall tab-bar-tab-group-function tab))
-   'face 'tab-bar-tab-group-inactive))
+(defun tab-bar-tab-group-format-default (tab i &optional current-p)
+  (let ((name (concat (if tab-bar-tab-hints (format "%d " i) "")
+                      (funcall tab-bar-tab-group-function tab)))
+        (face (if current-p
+                  'tab-bar-tab-group-current
+                'tab-bar-tab-group-inactive)))
+    (propertize name 'face face)))
 
 (defcustom tab-bar-tab-group-face-function #'tab-bar-tab-group-face-default
   "Function to define a tab group face.
@@ -881,10 +884,7 @@ tab-bar--format-tab-group
    `((,(intern (format "sep-%i" i)) menu-item ,(tab-bar-separator) ignore))
    `((,(intern (format "group-%i" i))
       menu-item
-      ,(if current-p
-           (propertize (funcall tab-bar-tab-group-function tab)
-                       'face 'tab-bar-tab-group-current)
-         (funcall tab-bar-tab-group-format-function tab i))
+      ,(funcall tab-bar-tab-group-format-function tab i current-p)
       ,(if current-p 'ignore
          (or
           (alist-get 'binding tab)
-- 
2.34.1


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


---
Gabriel

  reply	other threads:[~2022-12-15 15:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-14 20:16 bug#60073: 30.0.50; [PATCH] Tab bar group format not applied to current Gabriel
2022-12-15 15:04 ` Gabriel [this message]
2022-12-15 18:04   ` Juri Linkov
2022-12-15 18:05 ` 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=PH8PR19MB70703CA4706A7F995ADA1AED8BE19@PH8PR19MB7070.namprd19.prod.outlook.com \
    --to=gabriel376@hotmail.com \
    --cc=60073@debbugs.gnu.org \
    /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.