branch: elpa/popup
commit a9635a2392423cfe8912a43764f872fa4a2d8d7f
Author: Jen-Chieh Shen <jcs090...@gmail.com>
Commit: GitHub <nore...@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