branch: master
commit 859eb7844ac608fa48186ee124b2ca4ea7e98c6c
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
ivy.el (ivy-completing-read): Don't quote regex for files
Use case: `dired-dwim-target' is on, and `initial-input' is "c++". It
should not be quoted to "c\\+\\+".
---
ivy.el | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/ivy.el b/ivy.el
index d7441c6..15b92d0 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1798,13 +1798,15 @@ INHERIT-INPUT-METHOD is currently ignored."
collection
:predicate predicate
:require-match (and collection require-match)
- :initial-input (if (consp initial-input)
- (car initial-input)
- (if (and (stringp initial-input)
- (string-match "\\+" initial-input))
- (replace-regexp-in-string
- "\\+" "\\\\+" initial-input)
- initial-input))
+ :initial-input (cond ((consp initial-input)
+ (car initial-input))
+ ((and (stringp initial-input)
+ (not (eq collection
'read-file-name-internal))
+ (string-match "\\+" initial-input))
+ (replace-regexp-in-string
+ "\\+" "\\\\+" initial-input))
+ (t
+ initial-input))
:preselect (if (listp def) (car def) def)
:history history
:keymap nil