]> code.delx.au - gnu-emacs-elpa/commitdiff
Add support for Windows drive letters
authorGreg Lucas <greg@glucas.net>
Fri, 19 Jun 2015 15:56:00 +0000 (11:56 -0400)
committerGreg Lucas <greg@glucas.net>
Fri, 19 Jun 2015 15:56:00 +0000 (11:56 -0400)
ivy.el

diff --git a/ivy.el b/ivy.el
index 58d57ea2a1bf808ec18716d95af218dff028b90b..d0e05739a8b67b6c1eb1042353e99f7341bcd518 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -1150,7 +1150,14 @@ Should be run via minibuffer `post-command-hook'."
                (if (member ivy-text ivy--all-candidates)
                    (ivy--cd (expand-file-name ivy-text ivy--directory))
                  (when (string-match "//\\'" ivy-text)
-                   (ivy--cd "/")))
+                  (if (and default-directory
+                           (string-match "[[:alpha:]]:/" default-directory))
+                      (ivy--cd (match-string 0 default-directory))
+                    (ivy--cd "/")))
+                (when (string-match "[[:alpha:]]:/" ivy-text)
+                  (let ((drive-root (match-string 0 ivy-text)))
+                    (when (file-exists-p drive-root)
+                      (ivy--cd drive-root)))))
              (if (string-match "~\\'" ivy-text)
                  (ivy--cd (expand-file-name "~/")))))
           ((eq (ivy-state-collection ivy-last) 'internal-complete-buffer)