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

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

[elpa] master cd8a570 062/348: Escape `%` chars if present in the symbol


From: Oleh Krehel
Subject: [elpa] master cd8a570 062/348: Escape `%` chars if present in the symbol value
Date: Sat, 8 Apr 2017 11:03:25 -0400 (EDT)

branch: master
commit cd8a570d70c157e50e38dd0e8a5a5b43dc110077
Author: Kaushal Modi <address@hidden>
Commit: Kaushal Modi <address@hidden>

    Escape `%` chars if present in the symbol value
    
    * counsel-set-variable: The current value of the variable to be modified
      is displayed in the ivy prompt.  If the symbol value has literal '%'
      characters they need to be escaped to '%%' so that they are not
      processed by `ivy--reset-state`.
---
 counsel.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/counsel.el b/counsel.el
index 3d09b37..200e136 100644
--- a/counsel.el
+++ b/counsel.el
@@ -541,9 +541,11 @@ input corresponding to the chosen variable."
                 (setq cands '(("nil" . nil) ("t" . t))))
                (t nil)))
         (let* ((sym-val (symbol-value sym))
-               (res (ivy-read (format "Set (%S <%s>): " sym sym-val)
-                             cands
-                             :preselect (prin1-to-string sym-val))))
+               ;; Escape '%' chars if present
+               (sym-val-str (replace-regexp-in-string "%" "%%" (format "%s" 
sym-val)))
+               (res (ivy-read (format "Set (%S <%s>): " sym sym-val-str)
+                              cands
+                              :preselect (prin1-to-string sym-val))))
           (when res
             (setq res
                   (if (assoc res cands)



reply via email to

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