[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/telephone-line 2e7ba0bfc2 015/195: Make utf-8 separators a
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/telephone-line 2e7ba0bfc2 015/195: Make utf-8 separators a part of pbm separators, rather than separate entities altogether |
Date: |
Wed, 5 Jan 2022 02:59:17 -0500 (EST) |
branch: elpa/telephone-line
commit 2e7ba0bfc27a2584e0d38a9f34b51a258b8fef10
Author: Daniel Bordak <dbordak@fastmail.fm>
Commit: Daniel Bordak <dbordak@fastmail.fm>
Make utf-8 separators a part of pbm separators, rather than separate
entities altogether
The idea is that now a given separator function will have a graphic and
utf-8 version, so that you don't need to set up a conditional to decide which
separator you want.
---
telephone-line-separators.el | 48 ++++++++------------------------------------
telephone-line-utils.el | 28 +++++++++++++++-----------
2 files changed, 24 insertions(+), 52 deletions(-)
diff --git a/telephone-line-separators.el b/telephone-line-separators.el
index 6c2e507626..9716c04646 100644
--- a/telephone-line-separators.el
+++ b/telephone-line-separators.el
@@ -27,26 +27,6 @@
(require 'color)
(require 'telephone-line-utils)
-(defcustom telephone-line-utf-8-primary-left-separator #xe0b0
- "The unicode codepoint for the left facing primary separator."
- :group 'telephone-line
- :type '(choice integer (const nil)))
-
-(defcustom telephone-line-utf-8-secondary-left-separator #xe0b1
- "The unicode codepoint for the left facing secondary separator."
- :group 'telephone-line
- :type '(choice integer (const nil)))
-
-(defcustom telephone-line-utf-8-primary-right-separator #xe0b2
- "The unicode codepoint for the right facing primary separator."
- :group 'telephone-line
- :type '(choice integer (const nil)))
-
-(defcustom telephone-line-utf-8-secondary-right-separator #xe0b3
- "The unicode codepoint for the right facing secondary separator."
- :group 'telephone-line
- :type '(choice integer (const nil)))
-
(defun telephone-line-row-pattern-fixed-gradient (_ width)
"Create a gradient bytestring of WIDTH from FG-COLOR to BG-COLOR."
(mapcar (lambda (num)
@@ -54,13 +34,17 @@
(number-sequence 1 width)))
(telephone-line-defseparator telephone-line-abs-right
- #'abs #'telephone-line-row-pattern)
+ #'abs #'telephone-line-row-pattern
+ #xe0b2)
(telephone-line-defseparator telephone-line-abs-left
- (telephone-line-complement abs) #'telephone-line-row-pattern)
+ (telephone-line-complement abs) #'telephone-line-row-pattern
+ #xe0b0)
(telephone-line-defsubseparator telephone-line-abs-hollow-right
- #'abs #'telephone-line-row-pattern-hollow)
+ #'abs #'telephone-line-row-pattern-hollow
+ #xe0b3)
(telephone-line-defsubseparator telephone-line-abs-hollow-left
- (telephone-line-complement abs) #'telephone-line-row-pattern-hollow)
+ (telephone-line-complement abs) #'telephone-line-row-pattern-hollow
+ #xe0b1)
(telephone-line-defseparator telephone-line-cubed-right
(lambda (x) (expt x 3)) #'telephone-line-row-pattern)
(telephone-line-defseparator telephone-line-cubed-left
@@ -78,21 +62,5 @@
(defmemoize telephone-line-nil (color1 color2)
nil)
-(defmemoize telephone-line-utf-8-filled-left (foreground background)
- (propertize (char-to-string telephone-line-utf-8-primary-left-separator)
- 'face `(:foreground ,foreground :background ,background)))
-
-(defmemoize telephone-line-utf-8-filled-right (background foreground) ;Note
the reversed params
- (propertize (char-to-string telephone-line-utf-8-primary-right-separator)
- 'face `(:foreground ,foreground :background ,background)))
-
-(defmemoize telephone-line-utf-8-left (foreground background)
- (propertize (concat " " (char-to-string
telephone-line-utf-8-secondary-left-separator) " ")
- 'face `(:foreground ,foreground :background ,background)))
-
-(defmemoize telephone-line-utf-8-right (foreground background)
- (propertize (concat " " (char-to-string
telephone-line-utf-8-secondary-right-separator) " ")
- 'face `(:foreground ,foreground :background ,background)))
-
(provide 'telephone-line-separators)
;;; telephone-line-separators.el ends here
diff --git a/telephone-line-utils.el b/telephone-line-utils.el
index 3fb7d8d4e5..fac12947c9 100644
--- a/telephone-line-utils.el
+++ b/telephone-line-utils.el
@@ -139,26 +139,29 @@ color1 and color2."
(face-attribute arg :background)
arg))
-(defmacro -defseparator-internal (name body)
+(defmacro -defseparator-internal (name body &optional alt-string)
(declare (indent defun))
`(defmemoize ,name (foreground background)
- (when window-system
- (telephone-line-propertize-image
- (telephone-line--create-pbm-image
- ,body
- (telephone-line--separator-arg-handler background)
- (telephone-line--separator-arg-handler foreground))))))
-
-(defmacro defseparator (name axis-func pattern-func &optional forced-width)
+ (if window-system
+ (telephone-line-propertize-image
+ (telephone-line--create-pbm-image
+ ,body
+ (telephone-line--separator-arg-handler background)
+ (telephone-line--separator-arg-handler foreground)))
+ (propertize ,alt-string
+ 'face `(:foreground ,foreground :background ,background)))))
+
+(defmacro defseparator (name axis-func pattern-func &optional alt-char
forced-width)
"Define a separator named NAME, using AXIS-FUNC and PATTERN-FUNC to create
the shape, optionally forcing FORCED-WIDTH.
NOTE: Forced-width primary separators are not currently supported."
`(telephone-line--defseparator-internal ,name
(let ((height (telephone-line-separator-height))
(width (or ,forced-width (telephone-line-separator-width))))
- (telephone-line-create-body width height ,axis-func ,pattern-func))))
+ (telephone-line-create-body width height ,axis-func ,pattern-func))
+ (char-to-string ,alt-char)))
-(defmacro defsubseparator (name axis-func pattern-func &optional forced-width)
+(defmacro defsubseparator (name axis-func pattern-func &optional alt-char
forced-width)
"Define a subseparator named NAME, using AXIS-FUNC and PATTERN-FUNC to
create the shape, optionally forcing FORCED-WIDTH."
`(telephone-line--defseparator-internal ,name
(let* ((height (telephone-line-separator-height))
@@ -167,7 +170,8 @@ NOTE: Forced-width primary separators are not currently
supported."
telephone-line-separator-extra-padding)))
(telephone-line-pad-body
(telephone-line-create-body width height ,axis-func ,pattern-func)
- char-width))))
+ char-width))
+ (string ? ,alt-char ? )))
(defun pad-body (body char-width)
(let* ((body-width (length (car body)))
- [nongnu] elpa/telephone-line 6e1ecf51a2 147/195: Add doom/atom encoding segments, (continued)
- [nongnu] elpa/telephone-line 6e1ecf51a2 147/195: Add doom/atom encoding segments, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line cbaf1b8134 138/195: Switch guards to boundp checks rather than eval-after-load, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line e8e2078b43 131/195: Less bad name for unicode separators, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 212b3df07a 166/195: Merge pull request #92 from sebasmonia/master, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 6521585c94 180/195: Merge pull request #112 from fishyfriend/evil-god, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 06cbfc8d49 179/195: Add face for evil-god-state, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line deda33317b 187/195: Fix formatting, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line c5e08d268d 007/195: Move screenshots into subdir, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 0762bae37a 079/195: Corrected indentation, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 96030b4c98 026/195: Further clean up start of readme, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 2e7ba0bfc2 015/195: Make utf-8 separators a part of pbm separators, rather than separate entities altogether,
ELPA Syncer <=
- [nongnu] elpa/telephone-line 3e66e72d9c 075/195: add telephone-line-workgroups2-segment, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 85d25085ef 106/195: Trig Separators!, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line d0428bbd5c 108/195: Lighter color images, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 7fd38cce0c 093/195: Clarify config again, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 01a2be2798 129/195: Fix right separators on console, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 2cfe86ee8e 155/195: Merge pull request #76 from ogdenwebb/master, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line a8cb383957 168/195: 2 new segments: show just the file's name & show path AND file name, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line cce570e581 178/195: Provide TUI fallback for all separators, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line bfe7b189d7 177/195: Merge branch 'master' of github.com:dbordak/telephone-line, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 110c578ccf 184/195: Merge pull request #113 from gagbo/patch-2, ELPA Syncer, 2022/01/05