diff options
author | Adam Porter <adam@alphapapa.net> | 2021-09-24 04:47:56 +0000 |
---|---|---|
committer | Juri Linkov <juri@linkov.net> | 2021-09-25 22:18:11 +0300 |
commit | fcca1db9fd1eb2930f29972e7def0936c3269f1b (patch) | |
tree | 696e13fe9a2b75657b3bed2a5fc3f94e5f28c923 /lisp/tab-line.el | |
parent | fe5b20410f68546821e6c87577d7f826167491dc (diff) | |
download | emacs-fcca1db9fd1eb2930f29972e7def0936c3269f1b.tar.gz emacs-fcca1db9fd1eb2930f29972e7def0936c3269f1b.tar.bz2 emacs-fcca1db9fd1eb2930f29972e7def0936c3269f1b.zip |
* lisp/tab-line.el: Add modified-buffer face
(tab-line-tab-modified): New face.
(tab-line-tab-face-modified): New function.
(tab-line-tab-face-functions): Use new function.
* etc/NEWS: Update.
Diffstat (limited to 'lisp/tab-line.el')
-rw-r--r-- | lisp/tab-line.el | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 1f7af9e9a90..4a751b384e5 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -36,13 +36,15 @@ :group 'convenience :version "27.1") -(defcustom tab-line-tab-face-functions '(tab-line-tab-face-special) +(defcustom tab-line-tab-face-functions + '(tab-line-tab-face-modified tab-line-tab-face-special) "Functions called to modify tab faces. Each function is called with five arguments: the tab, a list of all tabs, the face returned by the previously called modifier, whether the tab is a buffer, and whether the tab is selected." :type '(repeat (choice (function-item tab-line-tab-face-special) + (function-item tab-line-tab-face-modified) (function-item tab-line-tab-face-inactive-alternating) (function-item tab-line-tab-face-group) (function :tag "Custom function"))) @@ -92,6 +94,14 @@ function `tab-line-tab-face-special'." :version "28.1" :group 'tab-line-faces) +(defface tab-line-tab-modified + '((t :inherit font-lock-doc-face)) + "Face for modified tabs. +Applied when option `tab-line-tab-face-functions' includes +function `tab-line-tab-face-modified'." + :version "28.1" + :group 'tab-line-faces) + (defface tab-line-tab-group '((t :inherit tab-line :box nil)) "Face for group tabs. @@ -537,6 +547,15 @@ When TAB is a non-file-backed buffer, make FACE inherit from (setf face `(:inherit (tab-line-tab-special ,face)))) face) +(defun tab-line-tab-face-modified (tab _tabs face buffer-p _selected-p) + "Return FACE for TAB according to whether it's modified. +When TAB is a modified, file-backed buffer, make FACE inherit +from `tab-line-tab-modified'. For use in +`tab-line-tab-face-functions'." + (when (and buffer-p (buffer-file-name tab) (buffer-modified-p tab)) + (setf face `(:inherit (tab-line-tab-modified ,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'." |