bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#50387: Possible bug in Tramp or in completions


From: Michael Albinus
Subject: bug#50387: Possible bug in Tramp or in completions
Date: Tue, 07 Sep 2021 19:31:51 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Gregory Heytings <gregory@heytings.org> writes:

Hi Gregory,

>> When I type "C-x C-f /scp: TAB", I see the same result as you,
>> "pscp:" and "scp:". However, the buffer *trace-output* contains
>>
>> ======================================================================
>> 1 -> (tramp-completion-handle-file-name-all-completions "" "/")
>> 1 <- tramp-completion-handle-file-name-all-completions: ("sudoedit:"
>> "sshfs:" "smb:" "rcp:" "remcp:" "scp:" "scpx:" "rsync:" "rsh:"
>> "remsh:" "ssh:" "sshx:" "telnet:" "nc:" "su:" "sg:" "sudo:" "doas:"
>> "ksu:" "krlogin:" "plink:" "plinkx:" "pscp:" "psftp:" "fcp:"
>> "rclone:" "afp:" "dav:" "davs:" "gdrive:" "mtp:" "nextcloud:"
>> "sftp:" "ftp:" "adb:")
>> ======================================================================
>> 1 -> (tramp-completion-handle-file-name-all-completions "" "/")
>> 1 <- tramp-completion-handle-file-name-all-completions: ("sudoedit:"
>> "sshfs:" "smb:" "rcp:" "remcp:" "scp:" "scpx:" "rsync:" "rsh:"
>> "remsh:" "ssh:" "sshx:" "telnet:" "nc:" "su:" "sg:" "sudo:" "doas:"
>> "ksu:" "krlogin:" "plink:" "plinkx:" "pscp:" "psftp:" "fcp:"
>> "rclone:" "afp:" "dav:" "davs:" "gdrive:" "mtp:" "nextcloud:"
>> "sftp:" "ftp:" "adb:")
>>
>> That means, "scp:" hasn't been passed to
>> tramp-completion-handle-file-name-all-completions, and the result of
>> that function looks proper to me.
>
> Yet it isn't.

Why not? In this example, `completion-styles' contains `substring'. And
then you ask for completion of "/scp:". Looking at the candidates
returned by `tramp-completion-handle-file-name-all-completions', only
"pscp:" and "scp:" have the substring "scp:".

Intuitively, I believe it is correct to show these two methods.

> By the way, before your attempt to fix the problem, you would have seen:
>
> 1 -> (tramp-completion-handle-file-name-all-completions "" "/")
> 1 <- tramp-completion-handle-file-name-all-completions: ("scp:" "scpx:")
>
> IOW, one side effect of your patch is that C-x C-f / TAB now displays
> all Tramp methods.

Yes.

> And you said in your reply to Stefan: "For a completion of "/" Tramp
> tries to be silent, in order not to surprise the many users which
> don't use Tramp with candidates like "/adb:". They wouldn't know
> what's that."  I fully agree with that, and the problem is that Tramp
> tried to be "too smart" here, and to display completions that
> correspond to tramp-default-method, which confuses completion
> mechanisms.

Indeed, I have changed my mind. The initial intention of Tramp's method
completion was to be not invasive, i.e. not to disturb Emacs users not
interested in Tramp.

Eli has reminded me, that we have changed Tramp later on such a way,
that its completion happens only when Tramp is loaded. This wasn't the
case before; Tramp was autoloaded just for its completion, which was not
appreciated by the users not interested in Tramp.

With that change, which is still preserved, there's no need for this
restriction any longer, because a user will see Tramp's completion only
after Tramp has been loaded.

> IOW again:
>
> - before your attempt to fix the problem, C-x C-f / TAB only displayed
>   "scp:" and "scpx:" among the completion candidates (or e.g. "ssh:",
>   "sshfs:" and "sshx:" with tramp-default-method set to "ssh");

Yes, this is changed.

> - now C-x C-f / TAB displays all Tramp methods;

When Tramp is loaded. I regard this to be correct.

> - with my patch, which actually fixes the bug, C-x C-f / TAB does not
>   display any Tramp method, as it should.

Again, C-x C-f / TAB displays a Tramp method only when Tramp is
loaded. What is wrong with this?

Best regards, Michael.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]