]> code.delx.au - gnu-emacs/blobdiff - lisp/ido.el
* window.c (Fwindow_height): Doc fix (bug#6518).
[gnu-emacs] / lisp / ido.el
index 48acc50581d73e927a38eaef4d117093a25ad795..6cedccb37875892400da56f8308d1ede57c3330d 100644 (file)
@@ -2272,7 +2272,8 @@ If cursor is not at the end of the user input, move to end of input."
           (or ido-use-url-at-point ido-use-filename-at-point))
       (let (fn d)
        (require 'ffap)
-       ;; Duplicate code from ffap-guesser as we want different behavior for files and URLs.
+       ;; Duplicate code from ffap-guesser as we want different
+       ;; behavior for files and URLs.
        (cond
         ((with-no-warnings
            (and ido-use-url-at-point
@@ -2288,7 +2289,10 @@ If cursor is not at the end of the user input, move to end of input."
                              (ffap-guesser)
                            (ffap-string-at-point))))
               (not (string-match "^http:/" fn))
-              (setq d (file-name-directory (expand-file-name fn)))
+              (let ((absolute-fn (expand-file-name fn)))
+                (setq d (if (file-directory-p absolute-fn)
+                            (file-name-as-directory absolute-fn)
+                          (file-name-directory absolute-fn))))
               (file-directory-p d))
          (setq ido-current-directory d)
          (setq initial (file-name-nondirectory fn))))))