branch: externals/ivy-hydra
commit 06886f104eb0b459b79696fdc376e3e9618c4d7b
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
ivy.el (ivy--tramp-prefix-p): Extract
Re #2335
---
ivy.el | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/ivy.el b/ivy.el
index a696887..40b0241 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1027,18 +1027,7 @@ contains a single candidate.")
(string-match-p "\\`[^/]+:.*:.*\\'" ivy-text))
(string-match-p "\\`/[^/]+:.*:.*\\'" ivy-text))
(ivy-done))
- ((or (and (equal ivy--directory "/")
- (cond ((string-match
- "\\`\\([^/]+?\\):\\(?:\\(.*\\)@\\)?\\(.*\\)\\'"
- ivy-text)
- (setq ivy-text (ivy-state-current ivy-last)))
- ((string-match
- "\\`\\([^/]+?\\):\\(?:\\(.*\\)@\\)?\\(.*\\)\\'"
- (ivy-state-current ivy-last))
- (setq ivy-text (ivy-state-current ivy-last)))))
- (string-match
- "\\`/\\([^/]+?\\):\\(?:\\(.*\\)@\\)?\\(.*\\)\\'"
- ivy-text))
+ ((ivy--tramp-prefix-p)
(let ((method (match-string 1 ivy-text))
(user (match-string 2 ivy-text))
(rest (match-string 3 ivy-text))
@@ -1063,6 +1052,20 @@ contains a single candidate.")
(t
(ivy-done)))))
+(defun ivy--tramp-prefix-p ()
+ (or (and (equal ivy--directory "/")
+ (cond ((string-match
+ "\\`\\([^/]+?\\):\\(?:\\(.*\\)@\\)?\\(.*\\)\\'"
+ ivy-text)
+ (setq ivy-text (ivy-state-current ivy-last)))
+ ((string-match
+ "\\`\\([^/]+?\\):\\(?:\\(.*\\)@\\)?\\(.*\\)\\'"
+ (ivy-state-current ivy-last))
+ (setq ivy-text (ivy-state-current ivy-last)))))
+ (string-match
+ "\\`/\\([^/]+?\\):\\(?:\\(.*\\)@\\)?\\(.*\\)\\'"
+ ivy-text)))
+
(defun ivy-expand-file-if-directory (file-name)
"Expand FILE-NAME as directory.
When this directory doesn't exist, return nil."