branch: master
commit de2e81927b3362b346a6c7063a335448158776a1
Author: Erik Hetzner <e...@e6h.org>
Commit: Erik Hetzner <e...@e6h.org>

    Allow % in prompt string
    
    - quote % when passing prompt from ivy-completing-read to ivy-read
    - add documentation in ivy-read that all % should be quoted
---
 ivy.el |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ivy.el b/ivy.el
index 58b2529..e79bb9a 100644
--- a/ivy.el
+++ b/ivy.el
@@ -770,7 +770,8 @@ Directories come first."
 
 PROMPT is a string to prompt with; normally it ends in a colon
 and a space.  When PROMPT contains %d, it will be updated with
-the current number of matching candidates.
+the current number of matching candidates.  If % appears elsewhere
+in the PROMPT it should be quoted as %%.
 See also `ivy-count-format'.
 
 COLLECTION is a list of strings.
@@ -985,7 +986,8 @@ DEF is the default value.
 _INHERIT-INPUT-METHOD is ignored for now.
 
 The history, defaults and input-method arguments are ignored for now."
-  (ivy-read prompt collection
+  (ivy-read (replace-regexp-in-string "%" "%%" prompt)
+            collection
             :predicate predicate
             :require-match require-match
             :initial-input (if (consp initial-input)

Reply via email to