[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/telephone-line 9e4ba97039 058/195: Slight cleanup followin
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/telephone-line 9e4ba97039 058/195: Slight cleanup following the last two commits. |
Date: |
Wed, 5 Jan 2022 02:59:26 -0500 (EST) |
branch: elpa/telephone-line
commit 9e4ba9703968dba0b2cf8d2faabc0399f7855ba7
Author: Daniel Bordak <dbordak@fastmail.fm>
Commit: Daniel Bordak <dbordak@fastmail.fm>
Slight cleanup following the last two commits.
---
telephone-line-utils.el | 49 ++++++++++++++++++++++++-------------------------
1 file changed, 24 insertions(+), 25 deletions(-)
diff --git a/telephone-line-utils.el b/telephone-line-utils.el
index 236e8f9bca..82b94ae02c 100644
--- a/telephone-line-utils.el
+++ b/telephone-line-utils.el
@@ -140,17 +140,6 @@ color1 and color2."
(cons (- 1 rem) ;Right AA pixel
(make-list (- total intpadding 2) 1)))))) ;Right gap
-(defun telephone-line--create-body (width height axis-func pattern-func)
- "Create a bytestring of a PBM image body of dimensions WIDTH and HEIGHT, and
shape created from AXIS-FUNC and PATTERN-FUNC."
- (let* ((normalized-axis (telephone-line--normalize-axis
- (mapcar axis-func (telephone-line-create-axis
height))))
- (range (1+ (seq-max normalized-axis)))
- (scaling-factor (/ width (float range))))
- (mapcar (lambda (x)
- (funcall pattern-func
- (* x scaling-factor) width))
- normalized-axis)))
-
(defmacro telephone-line-complement (func)
"Return a function which is the complement of FUNC."
`(lambda (x)
@@ -209,21 +198,33 @@ Return nil for blank/empty strings."
(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)
- (image-cache :initform (make-hash-table :test 'equal))))
+ (image-cache :initform (make-hash-table :test 'equal :size 10))))
(defclass telephone-line-subseparator (telephone-line-separator)
((pattern-func :initarg :pattern-func :initform
#'telephone-line-row-pattern-hollow)))
-(defmethod telephone-line-separator-create-body ((obj
telephone-line-separator) &optional forced-width)
+(defun telephone-line--create-body (width height axis-func pattern-func)
+ "Create a bytestring of a PBM image body of dimensions WIDTH and HEIGHT, and
shape created from AXIS-FUNC and PATTERN-FUNC."
+ (let* ((normalized-axis (telephone-line--normalize-axis
+ (mapcar axis-func (telephone-line-create-axis
height))))
+ (range (1+ (seq-max normalized-axis)))
+ (scaling-factor (/ width (float range))))
+ (mapcar (lambda (x)
+ (funcall pattern-func
+ (* x scaling-factor) width))
+ normalized-axis)))
+
+(defmethod telephone-line-separator-create-body ((obj
telephone-line-separator))
(telephone-line--create-body (telephone-line-separator-width)
- (telephone-line-separator-height)
- (oref obj axis-func)
- (oref obj pattern-func)))
+ (telephone-line-separator-height)
+ (oref obj axis-func)
+ (oref obj pattern-func)))
-(defmethod telephone-line-separator-create-body ((obj
telephone-line-subseparator) &optional forced-width)
+(defmethod telephone-line-separator-create-body ((obj
telephone-line-subseparator))
(let* ((height (telephone-line-separator-height))
- (width (or forced-width (telephone-line-separator-width)))
+ (width (or (oref obj forced-width) (telephone-line-separator-width)))
(char-width (+ (ceiling width (frame-char-width))
telephone-line-separator-extra-padding)))
(telephone-line--pad-body
@@ -239,13 +240,11 @@ Return nil for blank/empty strings."
(if window-system
;; Return cached image if we have it.
(or (gethash hash-key (oref obj image-cache))
- (let ((height (telephone-line-separator-height))
- (width (telephone-line-separator-width)))
- (puthash hash-key
- (telephone-line-propertize-image
- (telephone-line--create-pbm-image
(telephone-line-separator-create-body obj)
- bg-color fg-color))
- (oref obj image-cache))))
+ (puthash hash-key
+ (telephone-line-propertize-image
+ (telephone-line--create-pbm-image
(telephone-line-separator-create-body obj)
+ bg-color fg-color))
+ (oref obj image-cache)))
(list :propertize (char-to-string (oref obj alt-char))
'face (list :foreground fg-color
- [nongnu] elpa/telephone-line 32245b5e30 072/195: Update copyright, (continued)
- [nongnu] elpa/telephone-line 32245b5e30 072/195: Update copyright, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 3ad335a4c4 028/195: Correct default rhs value, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 7feb552dcf 048/195: Remove names, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line a2e2b5652f 013/195: Add emacs version requirement, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line d991dd296f 019/195: Excessive autoloads, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line a0409eeaba 066/195: Fix incorrect colors on startup, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 8064222a9f 038/195: Advice needs docstrings too, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 199fa476a1 050/195: Remove redundant TODOs, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 34610ced86 034/195: Merge branch 'master' of github.com:dbordak/telephone-line, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 892d651828 043/195: Fix readme formatting, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 9e4ba97039 058/195: Slight cleanup following the last two commits.,
ELPA Syncer <=
- [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, 2022/01/05