GNU bug report logs - #50387
Possible bug in Tramp or in completions

Previous Next

Package: emacs;

Reported by: Gregory Heytings <gregory <at> heytings.org>

Date: Sun, 5 Sep 2021 00:45:01 UTC

Severity: normal

Done: Gregory Heytings <gregory <at> heytings.org>

Bug is archived. No further changes may be made.

Full log


Message #29 received at 50387 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 50387 <at> debbugs.gnu.org
Subject: Re: bug#50387: Possible bug in Tramp or in completions
Date: Mon, 06 Sep 2021 21:39:14 +0200
Gregory Heytings <gregory <at> heytings.org> writes:

> Hi Michael,

Hi Gregory,

> I'm not really an expert of completion mechanisms either, but what I
> do know is that what Tramp does with methods in completions is not
> consistent with the way completion mechanisms usually work.
>
> With emacs -Q and (require 'tramp), if you C-x C-f / TAB TAB, you'll
> see only two methods, namely "scp:" and "scpx:".  If you C-x C-f /a
> TAB TAB, you'll see two other methods "adb:" and "afp:".

Correct. We see

--8<---------------cut here---------------start------------->8---
$ emacs -Q -batch -l tramp --eval '(message "%S" (file-name-all-completions "" "/"))'

("scp:" "scpx:" "sbin/" "proc/" "bin/" "snap/" "opt/" "var/" "dev/" "lib64/" "./" "nonexistent/" "lost+found/" "media/" "root/" "srv/" "etc/" "mnt/" "../" "tmp/" "net/" "sys/" "lib/" "boot/" "home/" "run/" "usr/")

$ emacs -Q -batch -l tramp --eval '(message "%S" (file-name-all-completions "s" "/"))'

("sudoedit:" "sshfs:" "smb:" "scp:" "scpx:" "ssh:" "sshx:" "su:" "sg:" "sudo:" "sftp:" "sbin/" "snap/" "srv/" "sys/")
--8<---------------cut here---------------end--------------->8---

That is, if there's nothing which could be interpreted as method name
(and "" is nothing in this sense),
tramp-completion-handle-file-name-all-completions uses the default
method, "scp", instead, and it completes this to "scp: and "scpx:".

OTOH, if there is at least one character which could belong to a method
("s" in this case), tramp-completion-handle-file-name-all-completions
returns all possible completions of this like "sudoedit:", "sshfs:",
"smb:", "scp:", "scpx:", "ssh:", "sshx:", "su:", "sg:", "sudo:" and
"sftp:".

I believe this is consistent, and it is implemented like this for at
least 15 years I believe.

> If you now (add-to-list 'completion-styles 'substring), you still see
> "scp:" and "scpx:" after C-x C-f / TAB TAB, but you do not see any
> methods after C-x C-f /a TAB TAB.

What completion styles do with these results, is out of my
knowledge. The Tramp manual says

--8<---------------cut here---------------start------------->8---
User name and host name completion is activated only, if file name
completion has one of the styles ‘basic’, ‘emacs21’, or ‘emacs22’.
--8<---------------cut here---------------end--------------->8---

Does this help? Although I have added this sentence myself, I have done
this on recommendation by somebody, w/o really understanding why this is so.

>> I hope somebody else chimes in.
>
> Adding Stefan M in Cc.

Yes, hopefully he can tell us what happens then.

Best regards, Michael.




This bug report was last modified 3 years and 258 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.