summaryrefslogtreecommitdiff
path: root/lisp/net/tramp.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2023-02-11 18:11:56 +0100
committerMichael Albinus <michael.albinus@gmx.de>2023-02-11 18:11:56 +0100
commit838415525bd4e77a79e18af8e4f01ed004196c71 (patch)
treea818b60f493cbcc29808b4f5e624a513a88c3fc5 /lisp/net/tramp.el
parent85a2eb2c789e7f9c1afa838817b3e9ebecb49da4 (diff)
downloademacs-838415525bd4e77a79e18af8e4f01ed004196c71.tar.gz
Support Tramp user name completion
* lisp/net/tramp.el (tramp-build-completion-file-name-regexp) (tramp-completion-handle-expand-file-name) (tramp-completion-handle-file-name-directory): Support user name completion. * test/lisp/net/tramp-tests.el (tramp-test26-interactive-file-name-completion): Fix test.
Diffstat (limited to 'lisp/net/tramp.el')
-rw-r--r--lisp/net/tramp.el24
1 files changed, 19 insertions, 5 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 36305dda496..1cda8fc4c61 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1211,9 +1211,12 @@ The `ftp' syntax does not support methods.")
(? (regexp tramp-completion-method-regexp)
;; Method separator, user name and host name.
(? (regexp tramp-postfix-method-regexp)
- ;; This is a little bit lax, but it serves.
- (? (regexp tramp-host-regexp))))
-
+ (? (regexp tramp-user-regexp)
+ (regexp tramp-postfix-user-regexp))
+ (? (| (regexp tramp-host-regexp) ;; This includes a user.
+ (: (regexp tramp-prefix-ipv6-regexp)
+ (? (regexp tramp-ipv6-regexp)
+ (? (regexp tramp-postfix-ipv6-regexp))))))))
eos)))
(defvar tramp-completion-file-name-regexp
@@ -2958,7 +2961,8 @@ not in completion mode."
(concat dir filename))
((string-match-p
(rx bos (regexp tramp-prefix-regexp)
- (? (regexp tramp-method-regexp) (regexp tramp-postfix-method-regexp))
+ (? (regexp tramp-method-regexp) (regexp tramp-postfix-method-regexp)
+ (? (regexp tramp-user-regexp) (regexp tramp-postfix-user-regexp)))
eos)
dir)
(concat dir filename))
@@ -3250,11 +3254,21 @@ PARTIAL-USER must match USER, PARTIAL-HOST must match HOST."
(rx (group
(regexp tramp-prefix-regexp)
(group (regexp tramp-method-regexp))
- (regexp tramp-postfix-method-regexp)))
+ (regexp tramp-postfix-method-regexp)
+ (? (regexp tramp-user-regexp)
+ (regexp tramp-postfix-user-regexp))))
filename)
;; Is it a valid method?
(assoc (match-string 2 filename) tramp-methods))
(match-string 1 filename))
+ ((and (string-empty-p tramp-method-regexp)
+ (string-match
+ (rx (group
+ (regexp tramp-prefix-regexp)
+ (? (regexp tramp-user-regexp)
+ (regexp tramp-postfix-user-regexp))))
+ filename))
+ (match-string 1 filename))
((string-match
(rx (group (regexp tramp-prefix-regexp))
(regexp tramp-completion-method-regexp) eos)