[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#60505: 29.0.60; Fido Mode and Tramp Completion
From: |
Michael Albinus |
Subject: |
bug#60505: 29.0.60; Fido Mode and Tramp Completion |
Date: |
Fri, 03 Feb 2023 20:23:26 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Stefan Monnier <monnier@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@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.
- bug#60505: 29.0.60; Fido Mode and Tramp Completion, Gregory Heytings, 2023/02/01
- bug#60505: 29.0.60; Fido Mode and Tramp Completion, Michael Albinus, 2023/02/01
- bug#60505: 29.0.60; Fido Mode and Tramp Completion, Gregory Heytings, 2023/02/01
- bug#60505: 29.0.60; Fido Mode and Tramp Completion, Eli Zaretskii, 2023/02/02
- bug#60505: 29.0.60; Fido Mode and Tramp Completion, Michael Albinus, 2023/02/02
- bug#60505: 29.0.60; Fido Mode and Tramp Completion, Eli Zaretskii, 2023/02/02
- bug#60505: 29.0.60; Fido Mode and Tramp Completion, Stefan Monnier, 2023/02/02
- bug#60505: 29.0.60; Fido Mode and Tramp Completion, Michael Albinus, 2023/02/03
- bug#60505: 29.0.60; Fido Mode and Tramp Completion, Stefan Monnier, 2023/02/03
- bug#60505: 29.0.60; Fido Mode and Tramp Completion,
Michael Albinus <=
- bug#60505: 29.0.60; Fido Mode and Tramp Completion, Stefan Monnier, 2023/02/03
- bug#60505: 29.0.60; Fido Mode and Tramp Completion, Michael Albinus, 2023/02/04
- bug#60505: 29.0.60; Fido Mode and Tramp Completion, Stefan Monnier, 2023/02/04
- bug#60505: 29.0.60; Fido Mode and Tramp Completion, Gregory Heytings, 2023/02/03
- bug#60505: 29.0.60; Fido Mode and Tramp Completion, Michael Albinus, 2023/02/04
- bug#60505: 29.0.60; Fido Mode and Tramp Completion, Michael Albinus, 2023/02/06
- bug#60505: 29.0.60; Fido Mode and Tramp Completion, Gregory Heytings, 2023/02/06
- bug#60505: 29.0.60; Fido Mode and Tramp Completion, Michael Heerdegen, 2023/02/06
- bug#60505: 29.0.60; Fido Mode and Tramp Completion, Michael Albinus, 2023/02/07
- bug#60505: 29.0.60; Fido Mode and Tramp Completion, Michael Heerdegen, 2023/02/07