From 17d1b51b659eb68c559e70a00db5e5316e24bdad Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sun, 16 Feb 2014 06:15:47 +0200 Subject: [PATCH] * lisp/ido.el (ido-file-internal): Don't add the name of an existing directory twice. Fixes: debbugs:16747 --- lisp/ChangeLog | 5 +++++ lisp/ido.el | 16 ++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 32df40bd09..3f2d7ddc7c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-02-16 Dmitry Gutov + + * ido.el (ido-file-internal): Don't add the name of an existing + directory twice. (Bug#16747) + 2014-02-16 Glenn Morris * vc/ediff-init.el (ediff-use-faces, ediff-highlight-all-diffs): diff --git a/lisp/ido.el b/lisp/ido.el index 52dd3850ce..6c12894335 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -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)) -- 2.20.1