[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/telephone-line bfd9c8b431 067/195: New string trimmer fixe
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/telephone-line bfd9c8b431 067/195: New string trimmer fixes appearance of paradox line number segment |
Date: |
Wed, 5 Jan 2022 02:59:27 -0500 (EST) |
branch: elpa/telephone-line
commit bfd9c8b431ef46a2756bd82d978ad400a5fecaa2
Author: Daniel Bordak <dbordak@fastmail.fm>
Commit: Daniel Bordak <dbordak@fastmail.fm>
New string trimmer fixes appearance of paradox line number segment
---
telephone-line-segments.el | 12 +++++-------
telephone-line-utils.el | 14 +++++++++++---
telephone-line.el | 5 ++---
3 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/telephone-line-segments.el b/telephone-line-segments.el
index 0b132d60e1..cfb82394a8 100644
--- a/telephone-line-segments.el
+++ b/telephone-line-segments.el
@@ -24,8 +24,6 @@
(require 'telephone-line-utils)
-(require 's)
-
(telephone-line-defsegment telephone-line-vc-segment
vc-mode)
@@ -34,12 +32,13 @@
(telephone-line-defsegment telephone-line-position-segment
(if (eq major-mode 'paradox-menu-mode)
- mode-line-front-space ;Paradox fills this with position info.
+ ;;Paradox fills this with position info.
+ (telephone-line-trim (format-mode-line mode-line-front-space))
mode-line-position))
(telephone-line-defsegment telephone-line-airline-position-segment
(if (eq major-mode 'paradox-menu-mode)
- mode-line-front-space
+ (telephone-line-trim (format-mode-line mode-line-front-space))
'((-3 "%p") " %4l:%3c")))
(telephone-line-defsegment telephone-line-misc-info-segment
@@ -82,8 +81,7 @@ mouse-3: Toggle minor modes"
(telephone-line-defsegment* telephone-line-erc-modified-channels-segment
(when (boundp 'erc-modified-channels-object)
- (s-with erc-modified-channels-object
- s-trim (s-chop-suffix "]") (s-chop-prefix "["))))
+ (telephone-line-trim erc-modified-channels-object)))
(eval-after-load 'evil
'(telephone-line-defsegment* telephone-line-evil-tag-segment
@@ -95,7 +93,7 @@ mouse-3: Toggle minor modes"
(if telephone-line-evil-use-short-tag "VL" "V-LINE"))
(t "VISUAL"))))
(if telephone-line-evil-use-short-tag
- (s-left 2 tag)
+ (seq-take tag 2)
tag))))
(provide 'telephone-line-segments)
diff --git a/telephone-line-utils.el b/telephone-line-utils.el
index 1dcd3f73ac..c95c2b7318 100644
--- a/telephone-line-utils.el
+++ b/telephone-line-utils.el
@@ -23,7 +23,6 @@
(require 'color)
(require 'cl-generic)
-(require 's)
(require 'seq)
(defcustom telephone-line-height nil
@@ -41,6 +40,15 @@
:type 'boolean
:group 'telephone-line-evil)
+(defun telephone-line-trim (string)
+ "Ad-hoc string trim which removes spaces and up to the first brace from
STRING."
+ (let ((s (if (string-match "[\])][ ]*\\'" string)
+ (replace-match "" t t string)
+ string)))
+ (if (string-match "\\`[ ]*[\[(]" s)
+ (replace-match "" t t s)
+ s)))
+
(defun telephone-line-create-axis (length)
"Create an axis of length LENGTH.
For odd lengths, this is a sequence from -floor(LENGTH/2) to
@@ -242,8 +250,8 @@ Segment is not precompiled."
(defun telephone-line-raw (str &optional compiled)
"Conditionally render STR as mode-line data, or just verify output if not
COMPILED.
Return nil for blank/empty strings."
- (let ((trimmed-str (s-trim (format-mode-line str))))
- (unless (s-blank? trimmed-str)
+ (let ((trimmed-str (telephone-line-trim (format-mode-line str))))
+ (unless (seq-empty-p trimmed-str)
(if compiled
(replace-regexp-in-string "%" "%%" trimmed-str)
str))))
diff --git a/telephone-line.el b/telephone-line.el
index dc0d5160c3..9def78fb33 100644
--- a/telephone-line.el
+++ b/telephone-line.el
@@ -6,7 +6,7 @@
;; URL: https://github.com/dbordak/telephone-line
;; Version: 0.3
;; Keywords: mode-line
-;; Package-Requires: ((emacs "24.4") (cl-lib "0.5") (cl-generic "0.2") (s
"1.9.0") (seq "1.8"))
+;; Package-Requires: ((emacs "24.4") (cl-lib "0.5") (cl-generic "0.2") (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
@@ -34,7 +34,6 @@
(require 'telephone-line-segments)
(require 'seq)
-(require 's)
(require 'cl-lib)
(defgroup telephone-line nil
@@ -186,7 +185,7 @@ Secondary separators do not incur a background color
change."
cur-color-sym))))
(defun telephone-line-propertize-segment (pred face segment)
- (unless (s-blank? (s-trim (format-mode-line segment)))
+ (unless (seq-empty-p (telephone-line-trim (format-mode-line segment)))
(if pred
`(:propertize (" " ,segment " ") face ,face)
`(" " ,segment " "))))
- [nongnu] elpa/telephone-line 835179cc9b 060/195: Put segment stuff back in the correct place, further refactor for the new separators, (continued)
- [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, 2022/01/05
- [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 <=
- [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
- [nongnu] elpa/telephone-line 8372f7d37c 133/195: Add centered segment support, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 2fd44a2811 144/195: Add hud segment, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line e0eeb057ca 160/195: Actually check if the projectile stuff will work, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 305b5dbfec 163/195: Added minions-mode-segment, compatible with https://github.com/tarsius/minions., ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 74068cd04a 167/195: Added segments "plain" buffer name and modified-state-only. (#93), ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 17901f3911 170/195: Merge pull request #96 from MikeTheGreat/filename_segments, ELPA Syncer, 2022/01/05
- [nongnu] elpa/telephone-line 81ec9e3137 171/195: Respect 0/1-indexing setting, ELPA Syncer, 2022/01/05