diff options
| author | Michael Albinus | 2019-12-17 10:38:42 +0100 |
|---|---|---|
| committer | Michael Albinus | 2019-12-17 10:38:42 +0100 |
| commit | dba1be0a9b3e92717f7921335f8507c007df8ca6 (patch) | |
| tree | 46445d4e9fe9cff1234eb00d8af5c08827b8ae9d | |
| parent | 4b2c2faab83fe3b13430b837be7d450b5cd47caf (diff) | |
| download | emacs-dba1be0a9b3e92717f7921335f8507c007df8ca6.tar.gz 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.
| -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." | |||
| 3259 | (defun tramp-handle-file-name-completion | 3259 | (defun tramp-handle-file-name-completion |
| 3260 | (filename directory &optional predicate) | 3260 | (filename directory &optional predicate) |
| 3261 | "Like `file-name-completion' for Tramp files." | 3261 | "Like `file-name-completion' for Tramp files." |
| 3262 | (let (hits-ignored-extensions) | 3262 | (let (hits-ignored-extensions fnac) |
| 3263 | (setq fnac (file-name-all-completions filename directory)) | ||
| 3264 | ;; "." and ".." are never interesting as completions, and are | ||
| 3265 | ;; actually in the way in a directory with only one file. See | ||
| 3266 | ;; file_name_completion() in dired.c. | ||
| 3267 | (when (and (consp fnac) (= (length (delete "./" (delete "../" fnac))) 1)) | ||
| 3268 | (setq fnac (delete "./" (delete "../" fnac)))) | ||
| 3263 | (or | 3269 | (or |
| 3264 | (try-completion | 3270 | (try-completion |
| 3265 | filename (file-name-all-completions filename directory) | 3271 | filename fnac |
| 3266 | (lambda (x) | 3272 | (lambda (x) |
| 3267 | (when (funcall (or predicate #'identity) (expand-file-name x directory)) | 3273 | (when (funcall (or predicate #'identity) (expand-file-name x directory)) |
| 3268 | (not | 3274 | (not |