branch: master
commit 769023bb47fe30b60745d8237e35f7dbc02eeaaa
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
ivy.el (ivy-read): Use initial-input when completing files
* ivy.el (ivy-read): Unless `require-match', add `initial-input' to the
collection. This is important e.g. for `dired-dwim-target'.
---
ivy.el | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/ivy.el b/ivy.el
index 3b4fd5d..73ac9f0 100644
--- a/ivy.el
+++ b/ivy.el
@@ -407,9 +407,12 @@ When SORT is t, refer to `ivy-sort-functions-alist' for
sorting."
(setq coll (all-completions "" collection predicate))))
((eq collection 'read-file-name-internal)
(setq ivy--directory default-directory)
- (setq initial-input nil)
(setq coll
- (ivy--sorted-files default-directory)))
+ (ivy--sorted-files default-directory))
+ (when initial-input
+ (unless ivy-require-match
+ (setq coll (cons initial-input coll)))
+ (setq initial-input nil)))
((or (functionp collection)
(vectorp collection)
(listp (car collection)))