[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/telephone-line 8372f7d37c 133/195: Add centered segment su
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/telephone-line 8372f7d37c 133/195: Add centered segment support |
Date: |
Wed, 5 Jan 2022 02:59:39 -0500 (EST) |
branch: elpa/telephone-line
commit 8372f7d37c74df551087ee439c2d37e318c73d65
Author: Daniel Bordak <dbordak@fastmail.fm>
Commit: Daniel Bordak <dbordak@fastmail.fm>
Add centered segment support
---
telephone-line.el | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/telephone-line.el b/telephone-line.el
index 78c7c65c30..284aba3737 100644
--- a/telephone-line.el
+++ b/telephone-line.el
@@ -301,6 +301,12 @@ separators, as they are conditional, are evaluated
on-the-fly."
:type '(alist :key-type segment-color :value-type subsegment-list)
:group 'telephone-line)
+(defcustom telephone-line-center
+ nil
+ "Center 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))
@@ -314,6 +320,18 @@ separators, as they are conditional, are evaluated
on-the-fly."
telephone-line-primary-left-separator
telephone-line-secondary-left-separator))
+(defun telephone-line--generate-mode-line-center ()
+ (when telephone-line-center
+ (let* ((part (seq-position telephone-line-center 'center))
+ (center-left (seq-take telephone-line-center part))
+ (center-right (seq-drop telephone-line-center (1+ part))))
+ (append (telephone-line-add-separators center-left
+ telephone-line-primary-right-separator
+ telephone-line-secondary-right-separator)
+ (telephone-line-add-separators center-right
+ telephone-line-primary-left-separator
+ telephone-line-secondary-left-separator)))))
+
(defun telephone-line--generate-mode-line-rhs ()
(telephone-line-add-separators telephone-line-rhs
telephone-line-primary-right-separator
@@ -321,6 +339,16 @@ separators, as they are conditional, are evaluated
on-the-fly."
(defun telephone-line--generate-mode-line ()
`(,@(telephone-line--generate-mode-line-lhs)
+ (:eval (when telephone-line-center
+ (telephone-line-fill
+ (/ (+ (window-width)
+ (telephone-line-width
+ ',(telephone-line--generate-mode-line-center)
+ ,(- (length telephone-line-rhs) 1)
+ ,telephone-line-primary-right-separator))
+ 2)
+ (telephone-line-face-map (caar telephone-line-center)))))
+ ,@(telephone-line--generate-mode-line-center)
(:eval (telephone-line-fill
(telephone-line-width
',(telephone-line--generate-mode-line-rhs)
- [nongnu] elpa/telephone-line 426a598c4a 056/195: Start work on memoize replacement, (continued)
- [nongnu] elpa/telephone-line 426a598c4a 056/195: Start work on memoize replacement, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line c73b2c210d 027/195: Fix face definitions, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 5c0af25f19 073/195: Explain config ordering, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 74cd7ea3ee 082/195: Fix telephone-line-nil, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line b2439795a4 078/195: Improve default colors., ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 07858899cc 052/195: Readme update, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line bfd9c8b431 067/195: New string trimmer fixes appearance of paradox line number segment, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 778d435ad2 109/195: Fix support for Emacs<25, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 36a6583157 156/195: Add a bunch of docstrings to segments, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 0d23081c68 148/195: Add a couple faces for segments, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 8372f7d37c 133/195: Add centered segment support,
ELPA Syncer <=
- [nongnu] elpa/telephone-line 2fd44a2811 144/195: Add hud segment, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line e0eeb057ca 160/195: Actually check if the projectile stuff will work, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 305b5dbfec 163/195: Added minions-mode-segment, compatible with https://github.com/tarsius/minions., ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 74068cd04a 167/195: Added segments "plain" buffer name and modified-state-only. (#93), ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 17901f3911 170/195: Merge pull request #96 from MikeTheGreat/filename_segments, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 81ec9e3137 171/195: Respect 0/1-indexing setting, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 706cedb353 174/195: Merge pull request #109 from endoffile78/circe, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line c0363af166 176/195: Add height to the hash key to automatically handle font size changes, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line bc6075462f 185/195: Fix examples for telephone-line-defsegment, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line baf17f6f1c 186/195: Fixed parentheses in atom-eol-segment, ELPA Syncer, 2022/01/05