[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/telephone-line 4b4a1fdaa3 080/195: Add face symbol map
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/telephone-line 4b4a1fdaa3 080/195: Add face symbol map |
Date: |
Wed, 5 Jan 2022 02:59:28 -0500 (EST) |
branch: elpa/telephone-line
commit 4b4a1fdaa39f2d70930b26507f00c3baa6b646b3
Author: Daniel Bordak <dbordak@fastmail.fm>
Commit: Daniel Bordak <dbordak@fastmail.fm>
Add face symbol map
---
telephone-line.el | 41 ++++++++++++++++++++++++++---------------
1 file changed, 26 insertions(+), 15 deletions(-)
diff --git a/telephone-line.el b/telephone-line.el
index 38e0a88934..f129792a08 100644
--- a/telephone-line.el
+++ b/telephone-line.el
@@ -90,6 +90,17 @@
"Face used in evil color-coded segments when in Emacs state."
:group 'telephone-line-evil)
+(defcustom telephone-line-faces
+ '((evil . telephone-line-evil-face)
+ (accent . (telephone-line-accent-active . telephone-line-accent-inactive))
+ (nil . (mode-line . mode-line-inactive)))
+ "Alist providing all the available face symbols.
+
+Symbols can either map to a pair of faces (ACTIVE . INACTIVE) or
+to a function which takes ACTIVE as a parameter."
+ :group 'telephone-line
+ :type '(alist :key-type color-symbol :value-type pair-or-function))
+
(defcustom telephone-line-primary-left-separator 'telephone-line-abs-left
"The primary separator to use on the left-hand side."
:group 'telephone-line
@@ -145,18 +156,16 @@ Secondary separators do not incur a background color
change."
(defun telephone-line--face-map (sym active)
"Return the face corresponding to SYM for the given ACTIVE state."
- (cond ((eq sym 'evil) (telephone-line-evil-face active))
- ((eq sym 'accent) (if active 'telephone-line-accent-active
- 'telephone-line-accent-inactive))
- (active 'mode-line)
- (t 'mode-line-inactive)))
+ (let ((pair-or-func (alist-get sym telephone-line-faces)))
+ (cond ((functionp pair-or-func) (funcall pair-or-func active))
+ (active (car pair-or-func))
+ (t (cdr pair-or-func)))))
(defun telephone-line-opposite-face-sym (sym)
"Return the 'opposite' of the given SYM."
- (cdr (assoc
- sym '((evil . nil)
- (accent . nil)
- (nil . accent)))))
+ (alist-get sym '((evil . nil)
+ (accent . nil)
+ (nil . accent))))
(defun telephone-line-evil-face (active)
"Return an appropriate face for the current evil mode, given whether the
frame is ACTIVE."
@@ -240,16 +249,18 @@ separators, as they are conditional, are evaluated
on-the-fly."
(* num-separators (- separator-width (ceiling separator-width))))
base-width)))
-(defcustom telephone-line-lhs '((accent . (telephone-line-vc-segment))
- (nil . (telephone-line-minor-mode-segment
- telephone-line-buffer-segment)))
+(defcustom telephone-line-lhs
+ '((accent . (telephone-line-vc-segment))
+ (nil . (telephone-line-minor-mode-segment
+ telephone-line-buffer-segment)))
"Left hand side segment alist."
:type '(alist :key-type segment-color :value-type subsegment-list)
:group 'telephone-line)
-(defcustom telephone-line-rhs '((nil . (telephone-line-misc-info-segment
- telephone-line-major-mode-segment))
- (accent . (telephone-line-position-segment)))
+(defcustom telephone-line-rhs
+ '((nil . (telephone-line-misc-info-segment
+ telephone-line-major-mode-segment))
+ (accent . (telephone-line-position-segment)))
"Right hand side segment alist."
:type '(alist :key-type segment-color :value-type subsegment-list)
:group 'telephone-line)
- [nongnu] elpa/telephone-line 9e4ba97039 058/195: Slight cleanup following the last two commits., (continued)
- [nongnu] elpa/telephone-line 9e4ba97039 058/195: Slight cleanup following the last two commits., ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 366b70a73d 040/195: Mention inspiration, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 7dba615894 016/195: Make note about unicode in readme, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 2ba4ae049d 047/195: Fix paradox async progress bar, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line bc999daf13 031/195: More cl -> cl-lib, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line a686ae4af2 036/195: Change lhs/rhs from outside-in to left-to-right, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line e8b9714bf2 014/195: Merge branch 'master' of github.com:dbordak/telephone-line, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 21dda16645 070/195: Fix it the right way..., ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 2df6a1614b 012/195: Change default values of faces and separators according to review, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 627a41acca 071/195: Make Emacs 25 stop complaining, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 4b4a1fdaa3 080/195: Add face symbol map,
ELPA Syncer <=
- [nongnu] elpa/telephone-line fa2a272e98 029/195: Fix glaring separator issues, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line bcb747a5c0 023/195: Oops, another cl call, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line d80e1bd857 119/195: Radically redo segment definitions, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line d31a4a3e7f 121/195: Add experimental nyan-segment, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line abbeb654fb 095/195: Missed these from a while ago, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line a83dcda21b 096/195: Autoload the premade config, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 9822d32b2b 084/195: Update screenshots more, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line f1f017607f 094/195: Fill now uses first right-hand segment for color, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 2162bdf9a3 098/195: Fix issue with airline position, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 23195b81b4 112/195: Add support for subsegment modifiers; add :active modifier, ELPA Syncer, 2022/01/05