GNU bug report logs -
#60505
29.0.60; Fido Mode and Tramp Completion
Previous Next
Reported by: Julien Roy <julien <at> jroy.ca>
Date: Tue, 3 Jan 2023 00:22:02 UTC
Severity: normal
Merged with 51386,
52758,
53513,
54042
Found in versions 28.0.50, 29.0.50, 29.0.60
Fixed in version 29.2
Done: Michael Albinus <michael.albinus <at> gmx.de>
Bug is archived. No further changes may be made.
Full log
Message #85 received at 60505 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
Hi Stefan,
>> +(defun tramp-completion-handle-expand-file-name (filename &optional directory)
>> + "Like `expand-file-name' for partial Tramp files."
>> + (if (file-name-absolute-p filename)
>> + filename
>> + (concat (or directory default-directory "/") filename)))
>
> Hmm... shouldn't a "/" may need to be added if `directory` or
> `default-directory` doesn't end with one (except in cases like `/ssh:`)?
Rather not. We're speaking about the tramp-completion-file-name-handler,
which is activated for file names matching
"\\`\\(?:\\)?/\\(?:\\(?:\\(-\\|[[:alnum:]]\\{2,\\}\\)\\(?::\\)\\(?:\\([^/:|[:blank:]]+\\)\\(?:@\\)\\)?\\(\\(?:[%._[:alnum:]-]+\\|\\(?:\\[\\)\\(?:\\(?:[[:alnum:]]*:\\)+[.[:alnum:]]*\\)?\\(?:]\\)\\)\\(?:\\(?:#\\)\\(?:[[:digit:]]+\\)\\)?\\)?\\)\\(?:|\\)\\)*\\(?:\\(?:-\\|[[:alnum:]]+\\)\\(?:\\(?::\\)\\(?:[%._[:alnum:]-]+\\)?\\)?\\)?\\'".
It looks complex, but in practice it is everything until
"/method:user <at> host" without a trailing colon. No slash there.
It's value is
--8<---------------cut here---------------start------------->8---
(rx
bos
;; `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'.
(? (regexp tramp-volume-letter-regexp))
;; We cannot use `tramp-prefix-regexp', because it starts with `bol'.
(literal tramp-prefix-format)
;; Optional multi hops.
(* (regexp tramp-remote-file-name-spec-regexp)
(regexp tramp-postfix-hop-regexp))
;; Last hop.
(? (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))))
eos)
--8<---------------cut here---------------end--------------->8---
> Then again, maybe not. I don't understand enough of the details of when
> `tramp-completion-file-name-handler` is used (IOW what is meant exactly by
> "partial Tramp file name").
Exactly that.
> I didn't remember this part of the design, but it sounds good and does
> make changes to that part (like the proposed patch) "safer", so it's
> probably OK to try it on `master`.
There is no special design for it. Ordinary file name handler machinery.
> I wonder how this patch interacts with `locate-dominating-file`.
I'll check tomorrow. But since there isn't a slash in such filenames
(except the leading one), I expect it shall work. Needs more testing,
this case and other use cases.
> Stefan
Best regards, Michael.
This bug report was last modified 2 years and 93 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.