[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/telephone-line c4cab5a5dc 150/195: Merge branch 'master' o
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/telephone-line c4cab5a5dc 150/195: Merge branch 'master' of github.com:dbordak/telephone-line |
Date: |
Wed, 5 Jan 2022 02:59:41 -0500 (EST) |
branch: elpa/telephone-line
commit c4cab5a5dcaa577f7b92c14220c39b4db07dfa37
Merge: aa746faab1 1cc28a7811
Author: Daniel Bordak <dbordak@fastmail.fm>
Commit: Daniel Bordak <dbordak@fastmail.fm>
Merge branch 'master' of github.com:dbordak/telephone-line
---
telephone-line-segments.el | 39 +++++++++++++++++++++++++++++++++++++++
telephone-line-utils.el | 10 ++++++++--
2 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/telephone-line-segments.el b/telephone-line-segments.el
index 8750b2e01a..398a30573f 100644
--- a/telephone-line-segments.el
+++ b/telephone-line-segments.el
@@ -120,6 +120,45 @@ mouse-3: Toggle minor modes"
'mouse-2 #'mode-line-widen)
face ,face)))
+(defun telephone-line--hud-axis-func (y)
+ (let* ((height (or telephone-line-height (frame-char-height)))
+ (start (floor (* height (float (window-start))) (point-max)))
+ (end (ceiling (* height (float (window-end))) (point-max))))
+ (if (<= start y end) 1 0)))
+
+(defclass telephone-line--hud (telephone-line-separator)
+ ((axis-func :initarg :axis-func :initform #'telephone-line--hud-axis-func)
+ (axis-init :initarg :axis-init
+ :initform (lambda (height) (number-sequence 0 (- height 1))))
+ (pattern-func :initarg :pattern-func :initform
#'telephone-line-row-pattern-binary)
+ (image-cache :initform (make-hash-table :test 'equal :size 100))))
+
+(cl-defmethod telephone-line-separator-render-image ((obj telephone-line--hud)
foreground background)
+ "Find cached pbm of OBJ in FOREGROUND and BACKGROUND.
+If it doesn't exist, create and cache it."
+ (let* ((height (or telephone-line-height (frame-char-height)))
+ (start (floor (* height (float (window-start))) (point-max)))
+ (end (ceiling (* height (float (window-end))) (point-max)))
+ (hash-key (format "%s_%s_%d_%d" background foreground start end)))
+ ;; Return cached image if we have it.
+ (or (gethash hash-key (oref obj image-cache))
+ (puthash hash-key
+ (telephone-line-propertize-image
+ (telephone-line--create-pbm-image
+ (telephone-line-separator-create-body obj)
+ background foreground))
+ (oref obj image-cache)))))
+
+(defvar telephone-line-hud (make-instance 'telephone-line--hud))
+
+(telephone-line-defsegment telephone-line-hud-segment ()
+ (let ((fg (face-attribute face :foreground)))
+ (telephone-line-separator-render telephone-line-hud
+ (if (eq fg 'unspecified)
+ (face-attribute 'default :foreground)
+ fg)
+ face)))
+
(telephone-line-defsegment telephone-line-erc-modified-channels-segment ()
(when (boundp 'erc-modified-channels-object)
(string-trim erc-modified-channels-object)))
diff --git a/telephone-line-utils.el b/telephone-line-utils.el
index 2422b1b6dc..f7fed7c5db 100644
--- a/telephone-line-utils.el
+++ b/telephone-line-utils.el
@@ -114,7 +114,7 @@ color1 and color2."
(defun telephone-line-propertize-image (image)
"Return a propertized string of IMAGE."
- (propertize (make-string (ceiling (car (image-size image))) ? )
+ (propertize (make-string (ceiling (car (image-size image))) ?|)
'display image))
(defun telephone-line-row-pattern (fill total)
@@ -137,6 +137,11 @@ color1 and color2."
(cons (- 1 rem) ;Right AA pixel
(make-list (- total intpadding 2) 1)))))) ;Right gap
+(defun telephone-line-row-pattern-binary (fill total)
+ (if (= fill 0)
+ (make-list total 0)
+ (make-list total 1)))
+
(defmacro telephone-line-complement (func)
"Return a function which is the complement of FUNC."
`(lambda (x)
@@ -148,6 +153,7 @@ color1 and color2."
(defclass telephone-line-separator ()
((axis-func :initarg :axis-func)
+ (axis-init :initarg :axis-init :initform #'telephone-line-create-trig-axis)
(pattern-func :initarg :pattern-func :initform #'telephone-line-row-pattern)
(forced-width :initarg :forced-width :initform nil)
(alt-separator :initarg :alt-separator)
@@ -178,7 +184,7 @@ color1 and color2."
(width (telephone-line-separator-width obj))
(normalized-axis (telephone-line--normalize-axis
(mapcar (oref obj axis-func)
- (telephone-line-create-trig-axis height))))
+ (funcall (oref obj axis-init) height))))
(range (seq-max normalized-axis))
(scaling-factor (/ (1- width)(float range))))
(mapcar (lambda (x)
- [nongnu] elpa/telephone-line 3ede7e6ff3 122/195: Merge branch 'master' of github.com:dbordak/telephone-line, (continued)
- [nongnu] elpa/telephone-line 3ede7e6ff3 122/195: Merge branch 'master' of github.com:dbordak/telephone-line, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 6789e79806 124/195: Define nil separator in terms of a pattern func; fixes height support., ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 41f84d47cd 087/195: Add headings to examples, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 59005be15b 114/195: Add arg list to defsegment, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line c1f3a4dcc4 086/195: Add example configurations, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line ce5d99afd7 101/195: Oops., ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 762344f5e5 123/195: Subclass telephone-line-nil-separator, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 80b09f3357 113/195: Add :inactive modifier, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 46c0fd2617 120/195: Temp fix for :active/:inactive, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line de2e4d5c86 153/195: Fix telephone-line-warning docstring., ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line c4cab5a5dc 150/195: Merge branch 'master' of github.com:dbordak/telephone-line,
ELPA Syncer <=
- [nongnu] elpa/telephone-line 17bc3be4bf 145/195: Merge branch 'master' of github.com:dbordak/telephone-line, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line f30195b8a3 162/195: Remove dead function, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 65198f72f3 181/195: Merge pull request #111 from gagbo/patch-1, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line ff526441a2 195/195: Merge pull request #121 from skangas/bump-version, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line db5808e5db 065/195: Minor update, use new shim package instead of straight eieio, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 3cb6ab4afc 161/195: Fix for #83, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line ef753fae21 193/195: Bump version to 0.5, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 123ba1f990 158/195: Little fix for projectile-buffer-segment., ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line c077184452 191/195: Adapt flymake-segment to upstream changes, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 547979a092 194/195: Update copyright years, ELPA Syncer, 2022/01/05