emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/telephone-line 105defac6e 100/195: Remove telephone-line-t


From: ELPA Syncer
Subject: [nongnu] elpa/telephone-line 105defac6e 100/195: Remove telephone-line-trim
Date: Wed, 5 Jan 2022 02:59:30 -0500 (EST)

branch: elpa/telephone-line
commit 105defac6e96eb143cf5fe10c8a2e34fa9011607
Author: Daniel Bordak <dbordak@fastmail.fm>
Commit: Daniel Bordak <dbordak@fastmail.fm>

    Remove telephone-line-trim
    
    This was so rarely useful over built-in trimming that it should probably 
just be handled on a case-by-case basis. I don't even remember what segments 
might have this issue.
---
 telephone-line-utils.el | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/telephone-line-utils.el b/telephone-line-utils.el
index 3965e8721a..0ad4051fdf 100644
--- a/telephone-line-utils.el
+++ b/telephone-line-utils.el
@@ -24,6 +24,7 @@
 (require 'color)
 (require 'eieio)
 (require 'seq)
+(require 'subr-x)
 
 (defcustom telephone-line-height nil
   "Override the mode-line height."
@@ -40,15 +41,6 @@
   :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
@@ -254,7 +246,7 @@ 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 (telephone-line-trim (format-mode-line str))))
+  (let ((trimmed-str (string-trim (format-mode-line str))))
     (unless (seq-empty-p trimmed-str)
       (if compiled
           (replace-regexp-in-string "%" "%%" trimmed-str)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]