]> code.delx.au - gnu-emacs-elpa/commitdiff
ivy.el (ivy-read): Use initial-input when completing files
authorOleh Krehel <ohwoeowho@gmail.com>
Tue, 21 Apr 2015 13:09:43 +0000 (15:09 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Tue, 21 Apr 2015 13:09:43 +0000 (15:09 +0200)
* ivy.el (ivy-read): Unless `require-match', add `initial-input' to the
  collection. This is important e.g. for `dired-dwim-target'.

ivy.el

diff --git a/ivy.el b/ivy.el
index 3b4fd5ddd9c93fb53b80412a9a3eb0901cc3e3ed..73ac9f013e6c847d4d1e8c42858e95df9884920b 100644 (file)
--- 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)))