branch: elpa/telephone-line
commit 4885ebe7ae2b7b3ef6bea10a33843db76a6412f5
Author: Daniel Bordak <[email protected]>
Commit: Daniel Bordak <[email protected]>
Separate unicode separators out into their own class so they can be
intermixed with XPM separators
---
telephone-line-separators.el | 23 ++++++++++++++++++-----
telephone-line-utils.el | 21 +++++++++++++--------
2 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/telephone-line-separators.el b/telephone-line-separators.el
index a7829ea41e..ec12fbbf85 100644
--- a/telephone-line-separators.el
+++ b/telephone-line-separators.el
@@ -46,23 +46,36 @@
:axis-func #'identity
:pattern-func #'telephone-line-row-pattern-fixed-gradient))
+(defvar telephone-line-u-abs-right
+ (make-instance 'telephone-line-unicode-separator
+ :char #xe0b2
+ :inverse-video nil))
+(defvar telephone-line-u-abs-left
+ (make-instance 'telephone-line-unicode-separator
+ :char #xe0b0))
+(defvar telephone-line-u-abs-hollow-right
+ (make-instance 'telephone-line-unicode-separator
+ :char #xe0b3))
+(defvar telephone-line-u-abs-hollow-left
+ (make-instance 'telephone-line-unicode-separator
+ :char #xe0b1))
+
(defvar telephone-line-abs-right
(make-instance 'telephone-line-separator
:axis-func #'abs
- :alt-char #xe0b2
- :inverse-video nil))
+ :alt-separator telephone-line-u-abs-right))
(defvar telephone-line-abs-left
(make-instance 'telephone-line-separator
:axis-func (telephone-line-complement abs)
- :alt-char #xe0b0))
+ :alt-separator telephone-line-u-abs-left))
(defvar telephone-line-abs-hollow-right
(make-instance 'telephone-line-subseparator
:axis-func #'abs
- :alt-char #xe0b3))
+ :alt-separator telephone-line-u-abs-hollow-right))
(defvar telephone-line-abs-hollow-left
(make-instance 'telephone-line-subseparator
:axis-func (telephone-line-complement abs)
- :alt-char #xe0b1))
+ :alt-separator telephone-line-u-abs-hollow-left))
(defvar telephone-line-cubed-right
(make-instance 'telephone-line-separator
diff --git a/telephone-line-utils.el b/telephone-line-utils.el
index 7c631bfaa9..d30c42d15f 100644
--- a/telephone-line-utils.el
+++ b/telephone-line-utils.el
@@ -142,12 +142,15 @@ color1 and color2."
`(lambda (x)
(- (,func x))))
+(defclass telephone-line-unicode-separator ()
+ ((char :initarg :char)
+ (inverse-video :initarg :inverse-video :initform t)))
+
(defclass telephone-line-separator ()
((axis-func :initarg :axis-func)
(pattern-func :initarg :pattern-func :initform #'telephone-line-row-pattern)
(forced-width :initarg :forced-width :initform nil)
- (alt-char :initarg :alt-char)
- (inverse-video :initarg :inverse-video :initform t)
+ (alt-separator :initarg :alt-separator)
(image-cache :initform (make-hash-table :test 'equal :size 10))))
(cl-defmethod telephone-line-separator-height ((obj telephone-line-separator))
@@ -215,18 +218,20 @@ If it doesn't exist, create and cache it."
background foreground))
(oref obj image-cache)))))
-(cl-defmethod telephone-line-separator-render-unicode ((obj
telephone-line-separator) foreground background)
- (list :propertize (char-to-string (oref obj alt-char))
- 'face (list :foreground foreground
- :background background
- :inverse-video (oref obj inverse-video))))
+(cl-defmethod telephone-line-separator-render ((obj
telephone-line-unicode-separator) foreground background)
+ (let ((fg-color (telephone-line-separator--arg-handler foreground))
+ (bg-color (telephone-line-separator--arg-handler background)))
+ (list :propertize (char-to-string (oref obj char))
+ 'face (list :foreground fg-color
+ :background bg-color
+ :inverse-video (oref obj inverse-video)))))
(cl-defmethod telephone-line-separator-render ((obj telephone-line-separator)
foreground background)
(let ((fg-color (telephone-line-separator--arg-handler foreground))
(bg-color (telephone-line-separator--arg-handler background)))
(if window-system
(telephone-line-separator-render-image obj fg-color bg-color)
- (telephone-line-separator-render-unicode obj fg-color bg-color))))
+ (telephone-line-separator-render (oref obj alt-separator) fg-color
bg-color))))
(cl-defmethod telephone-line-separator-render ((obj
telephone-line-nil-separator) foreground background)
nil)