* lisp/ido.el (ido-file-internal): Don't add the name of an existing
authorDmitry Gutov <dgutov@yandex.ru>
Sun, 16 Feb 2014 04:15:47 +0000 (06:15 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 16 Feb 2014 04:15:47 +0000 (06:15 +0200)
directory twice.

Fixes: debbugs:16747

lisp/ChangeLog
lisp/ido.el

index 32df40b..3f2d7dd 100644 (file)
@@ -1,3 +1,8 @@
+2014-02-16  Dmitry Gutov  <dgutov@yandex.ru>
+
+       * ido.el (ido-file-internal): Don't add the name of an existing
+       directory twice.  (Bug#16747)
+
 2014-02-16  Glenn Morris  <rgm@gnu.org>
 
        * vc/ediff-init.el (ediff-use-faces, ediff-highlight-all-diffs):
index 52dd385..6c12894 100644 (file)
@@ -2375,14 +2375,14 @@ If cursor is not at the end of the user input, move to end of input."
                          (if (eq ido-use-filename-at-point 'guess)
                              (ffap-guesser)
                            (ffap-string-at-point))))
-              (not (string-match "^http:/" 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))))))
+              (not (string-match "^http:/" fn)))
+          (let ((absolute-fn (expand-file-name fn)))
+            (cond
+             ((file-directory-p absolute-fn)
+              (setq ido-current-directory (file-name-as-directory absolute-fn)))
+             ((file-directory-p (file-name-directory absolute-fn))
+              (setq ido-current-directory (file-name-directory absolute-fn))
+              (setq initial (file-name-nondirectory absolute-fn)))))))))
 
     (let (ido-saved-vc-hb
          (vc-handled-backends (and (boundp 'vc-handled-backends) vc-handled-backends))