diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2019-12-17 10:38:42 +0100 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2019-12-17 10:38:42 +0100 |
commit | dba1be0a9b3e92717f7921335f8507c007df8ca6 (patch) | |
tree | 46445d4e9fe9cff1234eb00d8af5c08827b8ae9d /lisp/net/tramp.el | |
parent | 4b2c2faab83fe3b13430b837be7d450b5cd47caf (diff) | |
download | emacs-dba1be0a9b3e92717f7921335f8507c007df8ca6.tar.gz emacs-dba1be0a9b3e92717f7921335f8507c007df8ca6.tar.bz2 emacs-dba1be0a9b3e92717f7921335f8507c007df8ca6.zip |
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.
Diffstat (limited to 'lisp/net/tramp.el')
-rw-r--r-- | lisp/net/tramp.el | 10 |
1 files changed, 8 insertions, 2 deletions
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 |