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

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

[nongnu] elpa/popup e597c1987c 2/3: * popup.el (popup-replace-displayabl


From: ELPA Syncer
Subject: [nongnu] elpa/popup e597c1987c 2/3: * popup.el (popup-replace-displayable): keep text properties of origin string.
Date: Tue, 28 Dec 2021 12:58:36 -0500 (EST)

branch: elpa/popup
commit e597c1987cbaceaf5e4057d203dbb80ba1bf94f8
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>

    * popup.el (popup-replace-displayable): keep text properties of origin 
string.
---
 popup.el | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/popup.el b/popup.el
index c50b6c9c0c..af7c9fcba9 100644
--- a/popup.el
+++ b/popup.el
@@ -242,14 +242,16 @@ 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."
+Optional argument REP is the replacement string of
+non-displayable character."
   (unless rep (setq rep ""))
   (let ((result ""))
-    (mapc (lambda (ch)
-            (setq result (concat result
-                                 (if (char-displayable-p ch) (string ch)
-                                   rep))))
-          str)
+    (dolist (string (split-string str ""))
+      (let* ((char (string-to-char string))
+             (string (if (char-displayable-p char)
+                         string
+                       rep)))
+        (setq result (concat result string))))
     result))
 
 (cl-defun popup-make-item (name



reply via email to

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