branch: master
commit 61bb9e09fd2c39c8b2f855b723a8fc9924ab9caf
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
Require TRAMP in time
* 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 | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/ivy.el b/ivy.el
index aaa7e11..b130ec9 100644
--- 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 ":"))))))