* bug#47118: 28.0.50; [PATCH] lisp/tab-line.el: Add face for group-tab
@ 2021-03-13 2:35 Gabriel
2021-03-14 9:16 ` Juri Linkov
0 siblings, 1 reply; 2+ messages in thread
From: Gabriel @ 2021-03-13 2:35 UTC (permalink / raw)
To: 47118
[-- Attachment #1: Type: text/plain, Size: 824 bytes --]
The problem:
When tab-line mode is enabled and configured to group buffers, a group
tab is added as the first tab. This is not a regular tab that displays a
buffer, but rather a tab to indicate the group. The face used for this
group-tab is the same of an inactive tab, which makes harder to
differentiate betweem a group tab and a regular tab that can be selected
to display a buffer.
How to reproduce:
1. emacs -Q
2. Configure tab groups by project:
(setq-default tab-line-tabs-buffer-group-function
(lambda (b) (with-current-buffer b (vc-root-dir)))
tab-line-tabs-function 'tab-line-tabs-buffer-groups)
3. Enable tab-line mode:
(global-tab-line-mode 1)
4. Open file from a project handled by some vc backend (e.g.: git)
5. The tab group will be displayed as the first tab with a common face
[-- Attachment #2: before-patch.png --]
[-- Type: image/png, Size: 35696 bytes --]
[-- Attachment #3: Type: text/plain, Size: 672 bytes --]
The proposed solution:
Add a new face for group tabs that can be configured via
'tab-line-tab-face-functions', similar to how
'tab-line-tab-face-special' works.
How to test:
1. emacs -Q
2. Apply the patch
3. Configure tab groups by project and group face:
(setq-default tab-line-tabs-buffer-group-function
(lambda (b) (with-current-buffer b (vc-root-dir)))
tab-line-tabs-function 'tab-line-tabs-buffer-groups
tab-line-tab-face-functions '(tab-line-tab-face-group))
4. Enable tab-line-mode:
(global-tab-line-mode 1)
5. Open file from a project handled by some vc backend (e.g.: git)
6. The tab group will be displayed with a different face
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0001-lisp-tab-line.el-Add-face-for-group-tab.patch --]
[-- Type: text/x-diff, Size: 2386 bytes --]
From b7244efe39a37e6d634ed81213fee64fcd10e97d Mon Sep 17 00:00:00 2001
From: Gabriel do Nascimento Ribeiro <gabriel.nascimento@nubank.com.br>
Date: Fri, 12 Mar 2021 23:12:10 -0300
Subject: [PATCH] lisp/tab-line.el: Add face for group-tab
(tab-line-tab-face-functions): Add choice for 'tab-line-tab-face-group'.
(tab-line-tab-group): New face.
(tab-line-tab-current): Set alist key 'group-tab' for group tabs.
(tab-line-tab-face-group): New function to set face for group tabs.
---
lisp/tab-line.el | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index 903862a3e8..c4b504aaad 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -44,6 +44,7 @@ tab-line-tab-face-functions
:type '(repeat
(choice (function-item tab-line-tab-face-special)
(function-item tab-line-tab-face-inactive-alternating)
+ (function-item tab-line-tab-face-group)
(function :tag "Custom function")))
:group 'tab-line
:version "28.1")
@@ -95,6 +96,16 @@ tab-line-tab-special
:version "28.1"
:group 'tab-line-faces)
+(defface tab-line-tab-group
+ '((default
+ :inherit tab-line
+ :box nil))
+ "Face for group tabs.
+Applied when option `tab-line-tab-face-functions' includes
+function `tab-line-tab-face-group'."
+ :version "28.1"
+ :group 'tab-line-faces)
+
(defface tab-line-tab-current
'((default
:inherit tab-line-tab)
@@ -385,6 +396,7 @@ tab-line-tabs-buffer-groups
(set-window-parameter nil 'tab-line-group nil))))
(group-tab `(tab
(name . ,group)
+ (group-tab . t)
(select . ,(lambda ()
(set-window-parameter nil 'tab-line-groups t)
(set-window-parameter nil 'tab-line-group group)
@@ -520,6 +532,13 @@ tab-line-tab-face-special
(setf face `(:inherit (tab-line-tab-special ,face))))
face)
+(defun tab-line-tab-face-group (tab _tabs face _buffer-p _selected-p)
+ "Return FACE for TAB according to whether it's a group tab.
+For use in `tab-line-tab-face-functions'."
+ (when (alist-get 'group-tab tab)
+ (setf face `(:inherit (tab-line-tab-group ,face))))
+ face)
+
(defvar tab-line-auto-hscroll)
(defun tab-line-format ()
--
2.27.0
[-- Attachment #5: after-patch.png --]
[-- Type: image/png, Size: 35341 bytes --]
[-- Attachment #6: Type: text/plain, Size: 118 bytes --]
I am not sure what is the appropriate default value for the proposed new
face. Feel free to modify it, if necessary.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#47118: 28.0.50; [PATCH] lisp/tab-line.el: Add face for group-tab
2021-03-13 2:35 bug#47118: 28.0.50; [PATCH] lisp/tab-line.el: Add face for group-tab Gabriel
@ 2021-03-14 9:16 ` Juri Linkov
0 siblings, 0 replies; 2+ messages in thread
From: Juri Linkov @ 2021-03-14 9:16 UTC (permalink / raw)
To: Gabriel; +Cc: 47118
tags 47118 fixed
close 47118 28.0.50
thanks
> The proposed solution:
> Add a new face for group tabs that can be configured via
> 'tab-line-tab-face-functions', similar to how
> 'tab-line-tab-face-special' works.
This is a useful addition, thanks. Now pushed to master.
> I am not sure what is the appropriate default value for the proposed new
> face. Feel free to modify it, if necessary.
I think the current default is fine: it doesn't look like a tab,
while still looks like it belongs to the tab line.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-14 9:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-13 2:35 bug#47118: 28.0.50; [PATCH] lisp/tab-line.el: Add face for group-tab Gabriel
2021-03-14 9:16 ` Juri Linkov
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.