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

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

[elpa] master 59c5f16 044/272: Special case empty ivy-count-format compl


From: Oleh Krehel
Subject: [elpa] master 59c5f16 044/272: Special case empty ivy-count-format completion.
Date: Mon, 25 Apr 2016 10:13:15 +0000

branch: master
commit 59c5f166eae1ff18c8bc7ce4a1286fb6162b9fee
Author: Stephen Whipple <address@hidden>
Commit: Oleh Krehel <address@hidden>

    Special case empty ivy-count-format completion.
    
    - Switch ivy-count-format test to empty string rather than nil.
    - Since the prompt is based on user input, sanitize the prompt to
      later be formatted, except in the case of empty ivy-count-format.
    
    Fixes #349
---
 ivy.el |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/ivy.el b/ivy.el
index 33c9017..96b04e0 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1412,10 +1412,14 @@ The previous string is between `ivy-completion-beg' and 
`ivy-completion-end'."
              (substring-no-properties
               (car comps))))
         (let* ((w (1+ (floor (log (length comps) 10))))
-               (ivy-count-format (and ivy-count-format
-                                      (format "%%-%dd " w))))
+               (ivy-count-format (if (string= ivy-count-format "")
+                                     ivy-count-format
+                                   (format "%%-%dd " w)))
+               (prompt (format "(%s): " str)))
           (and
-           (ivy-read (format "(%s): " str)
+           (ivy-read (if (string= ivy-count-format "")
+                         prompt
+                       (replace-regexp-in-string "%" "%%" prompt))
                      ;; remove 'completions-first-difference face
                      (mapcar #'substring-no-properties comps)
                      :predicate predicate



reply via email to

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