emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 5a2e0fd 30/31: Allow for "/ssh:user@" as well as for "/ssh


From: Oleh Krehel
Subject: [elpa] master 5a2e0fd 30/31: Allow for "/ssh:user@" as well as for "/ssh:"
Date: Fri, 01 May 2015 14:29:06 +0000

branch: master
commit 5a2e0fd355fea83e3c172402b965a1aa826fcc0c
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    Allow for "/ssh:user@" as well as for "/ssh:"
    
    * ivy.el (ivy-alt-done): Update.
    
    Re #59
---
 ivy.el |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/ivy.el b/ivy.el
index d279535..a6d3c4f 100644
--- a/ivy.el
+++ b/ivy.el
@@ -250,18 +250,22 @@ When ARG is t, exit with current text, ignoring the 
candidates."
                                 ivy--current ivy--directory))))))
              (ivy--cd dir)
              (ivy--exhibit))
-            ((string-match "\\`/\\([^/]+\\)[:@]\\'" ivy-text)
-             (let ((full-method ivy-text)
-                   (method (match-string 1 ivy-text))
+            ((string-match "^/\\([^/]+?\\):\\(?:\\(.*\\)@\\)?" ivy-text)
+             (let ((method (match-string 1 ivy-text))
+                   (user (match-string 2 ivy-text))
                    res)
                (dolist (x (tramp-get-completion-function method))
                  (setq res (append res (funcall (car x) (cadr x)))))
                (setq res (delq nil res))
+               (when user
+                 (dolist (x res)
+                   (setcar x user)))
+               (setq res (cl-delete-duplicates res :test 'equal))
                (let ((host (ivy-read "Find File: "
                                      (mapcar #'ivy-build-tramp-name res))))
                  (when host
                    (setq ivy--directory "/")
-                   (ivy--cd (concat full-method host ":"))))))
+                   (ivy--cd (concat "/" method ":" host ":"))))))
             (t
              (ivy-done))))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]