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

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

[nongnu] elpa/popup a9635a2392: fix(popup.el): Use faster popup-replace-


From: ELPA Syncer
Subject: [nongnu] elpa/popup a9635a2392: fix(popup.el): Use faster popup-replace-displayable implementation
Date: Tue, 27 Sep 2022 03:59:05 -0400 (EDT)

branch: elpa/popup
commit a9635a2392423cfe8912a43764f872fa4a2d8d7f
Author: Jen-Chieh Shen <jcs090218@gmail.com>
Commit: GitHub <noreply@github.com>

    fix(popup.el): Use faster popup-replace-displayable implementation
---
 popup.el | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/popup.el b/popup.el
index c65118da6a..de730e0adf 100644
--- a/popup.el
+++ b/popup.el
@@ -242,16 +242,13 @@ ITEM is not string."
 (defun popup-replace-displayable (str &optional rep)
   "Replace non-displayable character from STR.
 
-Optional argument REP is the replacement string of
-non-displayable character."
-  (unless rep (setq rep ""))
-  (let ((result ""))
-    (dolist (string (split-string str ""))
-      (let* ((char (string-to-char string))
-             (string (if (char-displayable-p char)
-                         string
-                       rep)))
-        (setq result (concat result string))))
+Optional argument REP is the replacement string of non-displayable character."
+  (let ((result "") (rep (or rep "")))
+    (mapc (lambda (ch)
+            (setq result (concat result
+                                 (if (char-displayable-p ch) (string ch)
+                                   rep))))
+          str)
     result))
 
 (cl-defun popup-make-item (name



reply via email to

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