branch: elpa/telephone-line
commit 5ccd246d252e3f2e052fe35449c81c8ded66a9ad
Author: Daniel Bordak <[email protected]>
Commit: Daniel Bordak <[email protected]>
Documentation update
---
telephone-line-separators.el | 2 +-
telephone-line-utils.el | 13 ++++++++++---
telephone-line.el | 5 +++--
3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/telephone-line-separators.el b/telephone-line-separators.el
index 227e0d3fd5..06727cd7b0 100644
--- a/telephone-line-separators.el
+++ b/telephone-line-separators.el
@@ -28,7 +28,7 @@
(require 'telephone-line-utils)
(defun telephone-line-row-pattern-fixed-gradient (_ width)
- "Create a gradient bytestring of WIDTH from FG-COLOR to BG-COLOR."
+ "Create a gradient bytestring of WIDTH."
(mapcar (lambda (num)
(/ num (float width)))
(number-sequence 1 width)))
diff --git a/telephone-line-utils.el b/telephone-line-utils.el
index 0780760a14..62fadf9ed6 100644
--- a/telephone-line-utils.el
+++ b/telephone-line-utils.el
@@ -19,11 +19,13 @@
;;; Code:
-(require 'memoize)
(require 'cl-lib)
-(require 'seq)
(require 'color)
+(require 'memoize)
+(require 's)
+(require 'seq)
+
(defcustom telephone-line-height nil
"Override the mode-line height."
:group 'telephone-line
@@ -101,6 +103,7 @@ color1 and color2."
;; TODO: error on non-rectangular input?
(defun telephone-line--create-pbm-image (body fg-color bg-color)
+ "Create a pbm image from a byte list BODY and colors FG-COLOR and BG-COLOR."
(create-image
(concat
(format "P6 %d %d 255 " (length (car body)) (length body))
@@ -118,7 +121,7 @@ color1 and color2."
'display image))
(defun telephone-line-row-pattern (fill total)
- "Make a PBM line that has FILL FG-COLOR bytes out of TOTAL BG-COLOR bytes."
+ "Make a list of percentages (0 to 1), with FILL 0s out of TOTAL 1s, with a
non-integer in between."
(seq-let (intfill rem) (cl-floor fill)
(nconc
(make-list intfill 0) ;Left fill
@@ -127,6 +130,7 @@ color1 and color2."
(make-list (- total intfill 1) 1)))))) ;Right gap
(defun telephone-line-row-pattern-hollow (padding total)
+ "Make a list of percentages (0 to 1), with a non-integer positioned PADDING
places in out of TOTAL places."
(seq-let (intpadding rem) (cl-floor padding)
(nconc
(make-list intpadding 1) ;Left gap
@@ -148,10 +152,12 @@ color1 and color2."
normalized-axis)))
(defmacro telephone-line-complement (func)
+ "Return a function which is the complement of FUNC."
`(lambda (x)
(- (,func x))))
(defun telephone-line--separator-arg-handler (arg)
+ "Translate ARG into an appropriate color for a separator."
(if (facep arg)
(face-attribute arg :background)
arg))
@@ -180,6 +186,7 @@ NOTE: Forced-width primary separators are not currently
supported."
(char-to-string ,alt-char)))
(defun telephone-line--pad-body (body char-width)
+ "Pad 2d byte-list BODY to a width of CHAR-WIDTH, given as a number of
characters."
(let* ((body-width (length (car body)))
(padding-width (- (* char-width (frame-char-width)) body-width))
(left-padding (make-list (floor padding-width 2) 1))
diff --git a/telephone-line.el b/telephone-line.el
index f9fedd9c17..49aa66009a 100644
--- a/telephone-line.el
+++ b/telephone-line.el
@@ -121,6 +121,8 @@ Secondary separators do not incur a background color
change."
'display `((space :align-to (- (+ right right-fringe
right-margin)
,reserve)))))
+(defvar telephone-line-selected-window nil)
+
(defun telephone-line--set-selected-window ()
(when (not (minibuffer-window-active-p (frame-selected-window)))
(setq telephone-line-selected-window (frame-selected-window))))
@@ -135,8 +137,7 @@ Secondary separators do not incur a background color
change."
(defun telephone-line-selected-window-active ()
"Return whether the current window is active."
- (and (boundp 'telephone-line-selected-window)
- (eq telephone-line-selected-window (selected-window))))
+ (eq telephone-line-selected-window (selected-window)))
(defun telephone-line-face-map (sym)
"Return the face corresponding to SYM for the selected window's active
state."