From: Michael Albinus Date: Tue, 17 Dec 2019 09:38:42 +0000 (+0100) Subject: Improve Tramp's file-name-completion X-Git-Tag: emacs-27.0.90~336 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=dba1be0a9b3e92717f7921335f8507c007df8ca6;p=emacs.git Improve Tramp's file-name-completion * lisp/net/tramp.el (tramp-handle-file-name-completion): Filter out "./" and "../", if there's only one other result. --- diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 8988e57b8df..4b44d7a8031 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3259,10 +3259,16 @@ User is always nil." (defun tramp-handle-file-name-completion (filename directory &optional predicate) "Like `file-name-completion' for Tramp files." - (let (hits-ignored-extensions) + (let (hits-ignored-extensions fnac) + (setq fnac (file-name-all-completions filename directory)) + ;; "." and ".." are never interesting as completions, and are + ;; actually in the way in a directory with only one file. See + ;; file_name_completion() in dired.c. + (when (and (consp fnac) (= (length (delete "./" (delete "../" fnac))) 1)) + (setq fnac (delete "./" (delete "../" fnac)))) (or (try-completion - filename (file-name-all-completions filename directory) + filename fnac (lambda (x) (when (funcall (or predicate #'identity) (expand-file-name x directory)) (not