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 #44 received at 50387 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
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 20:55:15 +0000
[Message part 1 (text/plain, inline)]
Hi Michael,

>> * lisp/net/tramp.el (tramp-completion-handle-file-name-all-completions):
>> Do not return methods when the filename already contains a complete method.
>> Fixes bug#50387.
>
> I don't see this implemented. You rather don't return methods when the 
> filename does not contain a possible method string at all.
>

Yet this is what is happening.  You can try it yourself: emacs -Q, M-: 
(require 'tramp), M-: (add-to-list 'completion-styles 'substring), C-x C-f 
/scp: TAB.  This will display "Sole completion", and it displays "Sole 
completion" because "scp:" and "scpx:" are added in the completion 
candiates in tramp-completion-handle-file-name-all-completions.  You can 
see this with

(message "method '%s' result '%s'" method (tramp-get-completion-methods m))

around "Possible methods".  With C-x C-f /scp TAB, you will see

method ’scp’ result ’(nil nil nil nil nil nil nil nil nil nil nil nil nil 
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil /scpx: /scp: 
nil nil nil nil nil)’

which is correct, but with C-x C-f /scp: TAB, you will see

method ’’ result ’(nil nil nil nil nil nil nil nil nil nil nil nil nil nil 
nil nil nil nil nil nil nil nil nil nil nil nil nil nil /scpx: /scp: nil 
nil nil nil nil)’

which is wrong.

>>  	    ;; Possible methods.
>> -	    (setq result
>> -		  (append result (tramp-get-completion-methods m)))))))
>> +	    (unless (or (string-empty-p method)
>> +		        (string-empty-p user)
>> +		        (string-empty-p host))
>
> The check for (string-empty-p user) and (string-empty-p host) wouldn't 
> be needed, you are in the else branch of (or user host). IOW, user and 
> host are already nil, nothing left to test for them.
>

Whoops, yes, indeed.  Updated patch attached.
[Improve-handling-of-non-default-completion-styles-wi.patch (text/x-diff, attachment)]

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.