]> code.delx.au - gnu-emacs-elpa/commitdiff
Require TRAMP in time
authorOleh Krehel <ohwoeowho@gmail.com>
Tue, 16 Jun 2015 07:38:49 +0000 (09:38 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Tue, 16 Jun 2015 07:38:49 +0000 (09:38 +0200)
* ivy.el (ivy-alt-done): Require tramp before use. Store `ivy-last'
  before calling `ivy-read', since each `ivy-read' overwrites
  `ivy-last', and this one overwrites `counsel-find-file' action.

Fixes #145

ivy.el

diff --git a/ivy.el b/ivy.el
index aaa7e11f7fc98fbc6a854923e86f65589e240bf1..b130ec9c37773f4a8e8ce054c414772389d1528c 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -298,6 +298,7 @@ When ARG is t, exit with current text, ignoring the candidates."
              (let ((method (match-string 1 ivy-text))
                    (user (match-string 2 ivy-text))
                    res)
+               (require 'tramp)
                (dolist (x (tramp-get-completion-function method))
                  (setq res (append res (funcall (car x) (cadr x)))))
                (setq res (delq nil res))
@@ -305,8 +306,10 @@ When ARG is t, exit with current text, ignoring the candidates."
                  (dolist (x res)
                    (setcar x user)))
                (setq res (cl-delete-duplicates res :test #'equal))
-               (let ((host (ivy-read "Find File: "
+               (let ((old-ivy-last ivy-last)
+                     (host (ivy-read "Find File: "
                                      (mapcar #'ivy-build-tramp-name res))))
+                 (setq ivy-last old-ivy-last)
                  (when host
                    (setq ivy--directory "/")
                    (ivy--cd (concat "/" method ":" host ":"))))))