From 1d42f4800bc3759ac961b97b2a66d4b73e520eb5 Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Fri, 9 Apr 2021 09:57:06 +0200 Subject: [PATCH] Fix hostname completion on MS Windows * lisp/net/tramp.el (tramp-completion-file-name-regexp-default): Handle volume letter being added to paths for file name completion on W32 systems. This fixes hostname (and method) autocomplete on W32. Copyright-paperwork-exempt: yes --- lisp/net/tramp.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index b2c650f6e1a..e61c3b1e44c 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1078,7 +1078,13 @@ initial value is overwritten by the car of `tramp-file-name-structure'.") (defconst tramp-completion-file-name-regexp-default (concat - "\\`/\\(" + "\\`" + ;; `file-name-completion' uses absolute paths for matching. This + ;; means that on W32 systems, something like "/ssh:host:~/path" + ;; becomes "c:/ssh:host:~/path". See also `tramp-drop-volume-letter'. + (when (eq system-type 'windows-nt) + "\\(?:[[:alpha:]]:\\)?") + "/\\(" ;; Optional multi hop. "\\([^/|:]+:[^/|:]*|\\)*" ;; Last hop. -- 2.39.5