]> code.delx.au - gnu-emacs-elpa/commitdiff
Put the file instead of partial input on history
authorOleh Krehel <ohwoeowho@gmail.com>
Thu, 18 Jun 2015 11:40:44 +0000 (13:40 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Thu, 18 Jun 2015 11:40:44 +0000 (13:40 +0200)
* ivy.el (ivy-read): When completing file names, put the whole file name
on history, not just the partial input that lead to that name.
This is important in order for `ivy--cd-maybe' to work.

Re #152

ivy.el

diff --git a/ivy.el b/ivy.el
index ad4fe147a6959baec720e3f172c1115f0d56c08f..f6bd42c66519811617974fbf6c0f25d04b8d09af 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -824,9 +824,12 @@ candidates with each input."
                             nil
                             hist)))
                  (when (eq ivy-exit 'done)
-                   (set hist (cons (propertize ivy-text 'ivy-index ivy--index)
-                                   (delete ivy-text
-                                           (cdr (symbol-value hist)))))
+                   (let ((item (if ivy--directory
+                                   ivy--current
+                                 ivy-text)))
+                     (set hist (cons (propertize item 'ivy-index ivy--index)
+                                     (delete item
+                                             (cdr (symbol-value hist))))))
                    res)))
           (remove-hook 'post-command-hook #'ivy--exhibit)
           (when (setq unwind (ivy-state-unwind ivy-last))