[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/telephone-line 7a6ac904b3 059/195: Further consolidate old
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/telephone-line 7a6ac904b3 059/195: Further consolidate old stuff into new stuff |
Date: |
Wed, 5 Jan 2022 02:59:26 -0500 (EST) |
branch: elpa/telephone-line
commit 7a6ac904b380628257add1fd13b9ff0ace1a2713
Author: Daniel Bordak <dbordak@fastmail.fm>
Commit: Daniel Bordak <dbordak@fastmail.fm>
Further consolidate old stuff into new stuff
---
telephone-line-utils.el | 43 ++++++++++++++++---------------------------
telephone-line.el | 7 ++++---
2 files changed, 20 insertions(+), 30 deletions(-)
diff --git a/telephone-line-utils.el b/telephone-line-utils.el
index 82b94ae02c..ba1e92d000 100644
--- a/telephone-line-utils.el
+++ b/telephone-line-utils.el
@@ -41,14 +41,6 @@
:type 'boolean
:group 'telephone-line-evil)
-(defun telephone-line-separator-height ()
- "Get the height for a telephone-line separator."
- (or telephone-line-height (frame-char-height)))
-
-(defun telephone-line-separator-width ()
- "Get the default width for a telephone-line separator."
- (ceiling (telephone-line-separator-height) 2))
-
(defun telephone-line-create-axis (length)
"Create an axis of length LENGTH.
For odd lengths, this is a sequence from -floor(LENGTH/2) to
@@ -202,36 +194,33 @@ Return nil for blank/empty strings."
(alt-char :initarg :alt-char)
(image-cache :initform (make-hash-table :test 'equal :size 10))))
+(defmethod telephone-line-separator-height ((obj telephone-line-separator))
+ (or telephone-line-height (frame-char-height)))
+
+(defmethod telephone-line-separator-width ((obj telephone-line-separator))
+ (or (oref obj forced-width) (ceiling (telephone-line-separator-height obj)
2)))
+
(defclass telephone-line-subseparator (telephone-line-separator)
((pattern-func :initarg :pattern-func :initform
#'telephone-line-row-pattern-hollow)))
-(defun telephone-line--create-body (width height axis-func pattern-func)
+(defmethod telephone-line-separator-create-body ((obj
telephone-line-separator))
"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))))
+ (let* ((height (telephone-line-separator-height obj))
+ (width (telephone-line-separator-width obj))
+ (normalized-axis (telephone-line--normalize-axis
+ (mapcar (oref obj axis-func)
(telephone-line-create-axis height))))
(range (1+ (seq-max normalized-axis)))
(scaling-factor (/ width (float range))))
(mapcar (lambda (x)
- (funcall pattern-func
+ (funcall (oref obj 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)))
-
(defmethod telephone-line-separator-create-body ((obj
telephone-line-subseparator))
- (let* ((height (telephone-line-separator-height))
- (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
- (telephone-line--create-body width height
- (oref obj axis-func)
- (oref obj pattern-func))
- char-width)))
+ (telephone-line--pad-body (call-next-method)
+ (+ (ceiling (telephone-line-separator-width obj)
+ (frame-char-width))
+ telephone-line-separator-extra-padding)))
(defmethod telephone-line-separator-render ((obj telephone-line-separator)
foreground background)
(let* ((bg-color (telephone-line--separator-arg-handler background))
diff --git a/telephone-line.el b/telephone-line.el
index 4374b9767d..c76678d863 100644
--- a/telephone-line.el
+++ b/telephone-line.el
@@ -222,10 +222,10 @@ separators, as they are conditional, are evaluated
on-the-fly."
(seq-reverse segments))
'(nil . nil))))
-(defun telephone-line-width (values num-separators)
+(defun telephone-line-width (values num-separators separator)
"Get the column-length of VALUES, with NUM-SEPARATORS interposed."
(let ((base-width (string-width (format-mode-line values)))
- (separator-width (/ (telephone-line-separator-width)
+ (separator-width (/ (telephone-line-separator-width separator)
(float (frame-char-width)))))
(if window-system
(+ base-width
@@ -265,7 +265,8 @@ separators, as they are conditional, are evaluated
on-the-fly."
(:eval (telephone-line-fill
(telephone-line-width
',(telephone-line--generate-mode-line-rhs)
- ,(- (length telephone-line-rhs) 1))))
+ ,(- (length telephone-line-rhs) 1)
+ ,telephone-line-primary-right-separator)))
,@(telephone-line--generate-mode-line-rhs)))
(defvar telephone-line--default-mode-line mode-line-format)
- [nongnu] elpa/telephone-line a9d89b876d 157/195: Fix for symlinks, (continued)
- [nongnu] elpa/telephone-line a9d89b876d 157/195: Fix for symlinks, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 401a9c6ad6 159/195: Merge pull request #81 from ogdenwebb/fix-projectile-buffer-segment, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line fb62b73c9f 164/195: Add docstring for HUD axis func, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 0e6fbc2a23 165/195: Merge branch 'master' into master, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 1025d435af 169/195: Removed duplicate segment, renamed absolute-path segment for clarity, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 3a6c433348 173/195: Add support for irc clients that use tracking mode, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line bf35654a67 011/195: Merge pull request #7 from syohex/cl-lib, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 835179cc9b 060/195: Put segment stuff back in the correct place, further refactor for the new separators, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line ba6a56e027 018/195: Minor mode, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 41edbc236a 053/195: Not sure why I memoized this in the first place?, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 7a6ac904b3 059/195: Further consolidate old stuff into new stuff,
ELPA Syncer <=
- [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