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

From: Gregory Heytings <gregory <at> heytings.org>
To: bug-gnu-emacs <at> gnu.org
Subject: Possible bug in Tramp or in completions
Date: Sun, 05 Sep 2021 00:43:59 +0000
With a ~/.ssh/config file containing two entries:

Host foo
  ...
Host bar
  ...

emacs -Q
M-: (setq tramp-default-method "ssh")
M-: (add-to-list 'completion-styles 'substring)
C-x C-x /ssh: TAB

displays "Sole completion".  If, instead of having completion-styles set 
to:

(substring basic partial-completion emacs22)

it is set to:

(basic substring partial-completion emacs22)

then two completion candidates are shown (as expected): "ssh:foo:" and 
"ssh:bar:".

This happens because the "substring" completion mechanism is tried first 
by completion--some in completion--nth-completion, and returns (t . 
substring), because

(completion-substring-try-completion "/ssh:" #'completion-file-name-table 
#'file-exists-p 5)

returns t, because

(completion-substring--all-completions "/ssh:" 
#'completion-file-name-table #'file-exists-p 5) returns (("ssh:")

returns (prefix "ssh:") "/" "" 1), because

(completion-boundaries "/ssh:" #'completion-file-name-table 
#'file-exists-p "")

returns (1 . 0).

When the "basic" completion mechanism is tried first,

(completion-basic-try-completion "/ssh:" #'completion-file-name-table 
#'file-exists-p 5)

returns ("/ssh:" . 5).

It is not clear to me whether this is a bug (I always thought that the 
order of completion mechanisms in completion-styles did not matter, and in 
this case it does indeed make no difference with (setq 
tramp-default-method "scp")), and if so if it is a bug in Tramp, or in the 
completion functions.




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

Previous Next


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