aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJuri Linkov2026-04-14 20:14:15 +0300
committerJuri Linkov2026-04-14 20:14:15 +0300
commit0384600a21fb363e623afa658d1e66a54f79d2fb (patch)
tree8b7666d5bc0152b3f6fc8b8805c32a25b1422661 /lisp
parenta1899d8cb17e82e9729d39ce12ca0a8575690353 (diff)
downloademacs-master.tar.gz
emacs-master.zip
New faces 'tab-line-active' and 'tab-line-inactive' (bug#80742)HEADmaster
This is intended to parallel the 'mode-line-active/inactive' and 'header-line-active/inactive' distinction. * doc/emacs/display.texi (Standard Faces): Document the new faces. * lisp/faces.el (tab-line-active, tab-line-inactive): Add new faces. * lisp/tab-line.el (tab-line-faces): Add new faces to MEMBERS arg of 'defgroup'. (tab-line-auto-hscroll): Use one of the faces depending on 'mode-line-window-selected-p'. * src/dispextern.h (CURRENT_TAB_LINE_ACTIVE_FACE_ID_3) (CURRENT_TAB_LINE_ACTIVE_FACE_ID): New macros based on header-line equivalents. (CURRENT_TAB_LINE_HEIGHT): Use CURRENT_TAB_LINE_ACTIVE_FACE_ID. (face_id): Use TAB_LINE_ACTIVE_FACE_ID and TAB_LINE_INACTIVE_FACE_ID instead of TAB_LINE_FACE_ID. * src/xdisp.c (window_box_height, pos_visible_p, init_iterator) (window_text_pixel_size, display_mode_lines, display_mode_line) (format-mode-line): Replace all uses of TAB_LINE_FACE_ID with either a new macro or the new face IDs. * src/xfaces.c (lookup_basic_face, realize_basic_faces): Map new face IDs to their lisp symbols. (syms_of_xfaces): New lisp symbols.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/faces.el17
-rw-r--r--lisp/tab-line.el17
2 files changed, 28 insertions, 6 deletions
diff --git a/lisp/faces.el b/lisp/faces.el
index 6fe94927290..97620822b88 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -3005,7 +3005,22 @@ Note: Other faces cannot inherit from the cursor face."
3005 :background "grey") 3005 :background "grey")
3006 (t 3006 (t
3007 :inverse-video t)) 3007 :inverse-video t))
3008 "Tab line face." 3008 "Basic tab line face.
3009See `tab-line-active' and `tab-line-inactive' for the faces
3010used on tab lines."
3011 :version "31.1"
3012 :group 'basic-faces)
3013
3014(defface tab-line-active
3015 '((t :inherit tab-line))
3016 "Face for the selected tab line.
3017This inherits from the `tab-line' face."
3018 :version "31.1"
3019 :group 'basic-faces)
3020
3021(defface tab-line-inactive
3022 '((t :inherit tab-line))
3023 "Basic tab line face for non-selected windows."
3009 :version "31.1" 3024 :version "31.1"
3010 :group 'basic-faces) 3025 :group 'basic-faces)
3011 3026
diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index 832b2b74437..524799e445d 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -54,7 +54,11 @@ is selected."
54 :group 'tab-line 54 :group 'tab-line
55 :version "28.1") 55 :version "28.1")
56 56
57(defgroup tab-line-faces '((tab-line custom-face)) ; tab-line is defined in faces.el 57(defgroup tab-line-faces
58 ;; These faces are defined in faces.el
59 '((tab-line custom-face)
60 (tab-line-active custom-face)
61 (tab-line-inactive custom-face))
58 "Faces used in the tab line." 62 "Faces used in the tab line."
59 :group 'tab-line 63 :group 'tab-line
60 :group 'faces 64 :group 'faces
@@ -860,13 +864,16 @@ the selected tab visible."
860 (with-current-buffer tab-line-auto-hscroll-buffer 864 (with-current-buffer tab-line-auto-hscroll-buffer
861 (let ((truncate-partial-width-windows nil) 865 (let ((truncate-partial-width-windows nil)
862 (inhibit-modification-hooks t) 866 (inhibit-modification-hooks t)
867 (face (if (mode-line-window-selected-p)
868 'tab-line-active
869 'tab-line-inactive))
863 show-arrows) 870 show-arrows)
864 (setq truncate-lines nil 871 (setq truncate-lines nil
865 word-wrap nil) 872 word-wrap nil)
866 (erase-buffer) 873 (erase-buffer)
867 (apply 'insert strings) 874 (apply 'insert strings)
868 (goto-char (point-min)) 875 (goto-char (point-min))
869 (add-face-text-property (point-min) (point-max) 'tab-line t) 876 (add-face-text-property (point-min) (point-max) face t)
870 ;; Continuation means tab-line doesn't fit completely, 877 ;; Continuation means tab-line doesn't fit completely,
871 ;; thus scroll arrows are needed for scrolling. 878 ;; thus scroll arrows are needed for scrolling.
872 (setq show-arrows (> (vertical-motion 1) 0)) 879 (setq show-arrows (> (vertical-motion 1) 0))
@@ -888,7 +895,7 @@ the selected tab visible."
888 (erase-buffer) 895 (erase-buffer)
889 (apply 'insert (reverse (seq-subseq strings 0 (1+ selected)))) 896 (apply 'insert (reverse (seq-subseq strings 0 (1+ selected))))
890 (goto-char (point-min)) 897 (goto-char (point-min))
891 (add-face-text-property (point-min) (point-max) 'tab-line) 898 (add-face-text-property (point-min) (point-max) face)
892 (if (> (vertical-motion 1) 0) 899 (if (> (vertical-motion 1) 0)
893 (let* ((point (previous-single-property-change (point) 'tab)) 900 (let* ((point (previous-single-property-change (point) 'tab))
894 (tab-prop (when point 901 (tab-prop (when point
@@ -909,13 +916,13 @@ the selected tab visible."
909 (erase-buffer) 916 (erase-buffer)
910 (apply 'insert (seq-subseq strings (truncate hscroll) (1+ selected))) 917 (apply 'insert (seq-subseq strings (truncate hscroll) (1+ selected)))
911 (goto-char (point-min)) 918 (goto-char (point-min))
912 (add-face-text-property (point-min) (point-max) 'tab-line) 919 (add-face-text-property (point-min) (point-max) face)
913 (when (> (vertical-motion 1) 0) 920 (when (> (vertical-motion 1) 0)
914 ;; Not visible already 921 ;; Not visible already
915 (erase-buffer) 922 (erase-buffer)
916 (apply 'insert (reverse (seq-subseq strings 0 (1+ selected)))) 923 (apply 'insert (reverse (seq-subseq strings 0 (1+ selected))))
917 (goto-char (point-min)) 924 (goto-char (point-min))
918 (add-face-text-property (point-min) (point-max) 'tab-line) 925 (add-face-text-property (point-min) (point-max) face)
919 (when (> (vertical-motion 1) 0) 926 (when (> (vertical-motion 1) 0)
920 (let* ((point (previous-single-property-change (point) 'tab)) 927 (let* ((point (previous-single-property-change (point) 'tab))
921 (tab-prop (when point 928 (tab-prop (when point