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

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

[elpa] master 5269b79 07/54: When initial input contains a plus, escape


From: Oleh Krehel
Subject: [elpa] master 5269b79 07/54: When initial input contains a plus, escape it
Date: Tue, 29 Sep 2015 14:09:48 +0000

branch: master
commit 5269b799e1604c39495beaf7949a4547ef3afcf0
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    When initial input contains a plus, escape it
    
    * ivy.el (ivy-completing-read): Escape the plus in the initial input,
      for it to not be interpreted like a regex.
    
    Fixes #195
---
 ivy.el |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/ivy.el b/ivy.el
index b6b5d00..1eb6b7d 100644
--- a/ivy.el
+++ b/ivy.el
@@ -954,6 +954,7 @@ This is useful for recursive `ivy-read'."
             ((eq collection 'internal-complete-buffer)
              (setq coll (ivy--buffer-list "" ivy-use-virtual-buffers)))
             ((or (functionp collection)
+                 (byte-code-function-p collection)
                  (vectorp collection)
                  (listp (car collection)))
              (setq coll (all-completions "" collection predicate)))
@@ -1038,7 +1039,10 @@ The history, defaults and input-method arguments are 
ignored for now."
             :require-match require-match
             :initial-input (if (consp initial-input)
                                (car initial-input)
-                             initial-input)
+                             (if (string-match "\\+" initial-input)
+                                 (replace-regexp-in-string
+                                  "\\+" "\\\\+" initial-input)
+                               initial-input))
             :preselect (if (listp def) (car def) def)
             :history history
             :keymap nil



reply via email to

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