[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/telephone-line f5a1d0cbd2 057/195: Move over to new OO sep
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/telephone-line f5a1d0cbd2 057/195: Move over to new OO separators |
Date: |
Wed, 5 Jan 2022 02:59:26 -0500 (EST) |
branch: elpa/telephone-line
commit f5a1d0cbd24fc03501a66fc7415bfea2fece1470
Author: Daniel Bordak <dbordak@fastmail.fm>
Commit: Daniel Bordak <dbordak@fastmail.fm>
Move over to new OO separators
---
telephone-line-separators.el | 49 ++++++++++++++++++++++++--------------------
telephone-line-utils.el | 42 +------------------------------------
telephone-line.el | 6 +++---
3 files changed, 31 insertions(+), 66 deletions(-)
diff --git a/telephone-line-separators.el b/telephone-line-separators.el
index b786973c76..18909e0296 100644
--- a/telephone-line-separators.el
+++ b/telephone-line-separators.el
@@ -31,6 +31,11 @@
(/ num (float width)))
(number-sequence 1 width)))
+(defvar telephone-line-gradient
+ (telephone-line-separator "gradient"
+ :axis-func #'identity
+ :pattern-func #'telephone-line-row-pattern-fixed-gradient))
+
(defvar telephone-line-abs-right
(telephone-line-separator "abs-right"
:axis-func #'abs
@@ -48,30 +53,30 @@
:axis-func (telephone-line-complement abs)
:alt-char #xe0b2))
-(telephone-line-defseparator telephone-line-cubed-right
- (lambda (x) (expt x 3)) #'telephone-line-row-pattern)
-(telephone-line-defseparator telephone-line-cubed-left
- (lambda (x) (- (expt x 3))) #'telephone-line-row-pattern)
-(telephone-line-defsubseparator telephone-line-cubed-hollow-right
- (lambda (x) (expt x 3)) #'telephone-line-row-pattern-hollow)
-(telephone-line-defsubseparator telephone-line-cubed-hollow-left
- (lambda (x) (- (expt x 3))) #'telephone-line-row-pattern-hollow)
-
-(telephone-line-defseparator telephone-line-identity-right
- #'identity #'telephone-line-row-pattern)
-(telephone-line-defseparator telephone-line-identity-left
- #'- #'telephone-line-row-pattern)
-(telephone-line-defsubseparator telephone-line-identity-hollow-right
- #'identity #'telephone-line-row-pattern-hollow)
-(telephone-line-defsubseparator telephone-line-identity-hollow-left
- #'- #'telephone-line-row-pattern-hollow)
+(defvar telephone-line-cubed-right
+ (telephone-line-separator "cubed-right"
+ :axis-func (lambda (x) (expt x 3))))
+(defvar telephone-line-cubed-left
+ (telephone-line-separator "cubed-left"
+ :axis-func (lambda (x) (- (expt x 3)))))
+(defvar telephone-line-cubed-hollow-right
+ (telephone-line-subseparator "cubed-hollow-right"
+ :axis-func (lambda (x) (expt x 3))))
+(defvar telephone-line-cubed-hollow-left
+ (telephone-line-subseparator "cubed-hollow-left"
+ :axis-func (lambda (x) (- (expt x 3)))))
-(telephone-line-defseparator telephone-line-gradient
- #'identity #'telephone-line-row-pattern-fixed-gradient)
+(defvar telephone-line-identity-right
+ (telephone-line-separator "identity-right" :axis-func #'identity))
+(defvar telephone-line-identity-left
+ (telephone-line-separator "identity-left" :axis-func #'-))
+(defvar telephone-line-identity-hollow-right
+ (telephone-line-subseparator "identity-hollow-right" :axis-func #'identity))
+(defvar telephone-line-identity-hollow-left
+ (telephone-line-subseparator "identity-hollow-left" :axis-func #'-))
-(defun telephone-line-nil (color1 color2)
- "The nil separator. COLOR1 and COLOR2 are disregarded."
- nil)
+(defvar telephone-line-nil
+ (telephone-line-separator "nil" :axis-func (lambda (c1 c2) nil)))
(provide 'telephone-line-separators)
;;; telephone-line-separators.el ends here
diff --git a/telephone-line-utils.el b/telephone-line-utils.el
index e57b51bdd7..236e8f9bca 100644
--- a/telephone-line-utils.el
+++ b/telephone-line-utils.el
@@ -23,7 +23,6 @@
(require 'color)
(require 'eieio)
-(require 'memoize)
(require 's)
(require 'seq)
@@ -163,19 +162,6 @@ color1 and color2."
(face-attribute arg :background)
arg))
-(defmacro telephone-line--defseparator-internal (name body &optional
alt-string)
- (declare (indent defun))
- `(defmemoize ,name (foreground background)
- (let ((bg-color (telephone-line--separator-arg-handler background))
- (fg-color (telephone-line--separator-arg-handler foreground)))
- (if window-system
- (telephone-line-propertize-image
- (telephone-line--create-pbm-image ,body bg-color fg-color))
- (list :propertize ,alt-string
- 'face (list :foreground fg-color
- :background bg-color
- :inverse-video t))))))
-
(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)))
@@ -186,30 +172,6 @@ color1 and color2."
(append left-padding row right-padding))
body)))
-(defmacro telephone-line-defseparator (name axis-func pattern-func &optional
alt-char forced-width)
- "Define a separator named NAME, using AXIS-FUNC and PATTERN-FUNC to create
the shape, optionally forcing FORCED-WIDTH.
-
-NOTE: Forced-width primary separators are not currently supported."
- (declare (indent defun))
- `(telephone-line--defseparator-internal ,name
- (let ((height (telephone-line-separator-height))
- (width (or ,forced-width (telephone-line-separator-width))))
- (telephone-line--create-body width height ,axis-func ,pattern-func))
- (char-to-string ,alt-char)))
-
-(defmacro telephone-line-defsubseparator (name axis-func pattern-func
&optional alt-char forced-width)
- "Define a subseparator named NAME, using AXIS-FUNC and PATTERN-FUNC to
create the shape, optionally forcing FORCED-WIDTH."
- (declare (indent defun))
- `(telephone-line--defseparator-internal ,name
- (let* ((height (telephone-line-separator-height))
- (width (or ,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 ,axis-func ,pattern-func)
- char-width))
- (string ? ,alt-char ? )))
-
:autoload
(defmacro telephone-line-defsegment (name body)
"Create function NAME by wrapping BODY with telephone-line padding and
propertization."
@@ -299,9 +261,7 @@ Return nil for blank/empty strings."
(font-lock-add-keywords 'emacs-lisp-mode
'("\\<telephone-line-defsegment*\\>"
"\\<telephone-line-defsegment-plist\\>"
- "\\<telephone-line-defsegment\\>"
- "\\<telephone-line-defseparator\\>"
- "\\<telephone-line-defsubseparator\\>")))
+ "\\<telephone-line-defsegment\\>")))
(unless (fboundp 'elisp--font-lock-flush-elisp-buffers)
;; In Emacsā„25, (via elisp--font-lock-flush-elisp-buffers and a few others)
diff --git a/telephone-line.el b/telephone-line.el
index 08de3cc5c8..4374b9767d 100644
--- a/telephone-line.el
+++ b/telephone-line.el
@@ -6,7 +6,7 @@
;; URL: https://github.com/dbordak/telephone-line
;; Version: 0.2
;; Keywords: mode-line
-;; Package-Requires: ((emacs "24.3") (cl-lib "0.5") (memoize "1.0.1") (s
"1.9.0") (seq "1.8"))
+;; Package-Requires: ((emacs "24.3") (cl-lib "0.5") (eieio "1.4") (s "1.9.0")
(seq "1.8"))
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -178,8 +178,8 @@ Secondary separators do not incur a background color
change."
cur-subsegments ;New segment
;; Separator
`(:eval (telephone-line-separator-render ,primary-sep
- (telephone-line-face-map ',prev-color-sym)
- (telephone-line-face-map ',cur-color-sym)))
+ (telephone-line-face-map
',prev-color-sym)
+ (telephone-line-face-map
',cur-color-sym)))
accumulated-segments) ;Old segments
(list cur-subsegments))
cur-color-sym))))
- [nongnu] elpa/telephone-line 48f2894e95 046/195: Add initial support for multiple frames, (continued)
- [nongnu] elpa/telephone-line 48f2894e95 046/195: Add initial support for multiple frames, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 1f2389212b 024/195: Remove -enable and -disable entirely, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line de93becc18 039/195: Merge pull request #12 from bjpbakker/fix/erc-segment, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 5ccd246d25 049/195: Documentation update, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line ae636f7ca2 041/195: Version bump, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 8bc83573c3 061/195: Fix unicode separators, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 1b52832b44 054/195: Nameless indentation, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 676b57d819 081/195: Made subseparator colors customizeable, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 00600d46c9 042/195: Merge branch 'master' of github.com:dbordak/telephone-line, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 3bb5cee841 074/195: Update readme.org, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line f5a1d0cbd2 057/195: Move over to new OO separators,
ELPA Syncer <=
- [nongnu] elpa/telephone-line cac54930a1 115/195: Improve even heights., ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 105defac6e 100/195: Remove telephone-line-trim, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 0fec3265a0 118/195: Fix terminology before it's too late., ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line bf0e4394ec 104/195: Previous fix didn't account for hollow separators, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 2906d39401 116/195: Oops, don't want accidental rounding., ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 909c1779e4 089/195: Fixed rainbow face examples, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line aa2c6840c9 107/195: Add separator gallery, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 09ff89a090 110/195: Add alias for modal colorsym, rename tl-evil-face to tl-modal-face, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 541c7d80d9 103/195: Corrected axis algorithm, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 0715ee7d15 064/195: Fix Readme formatting, ELPA Syncer, 2022/01/05