Subject: Re: bug#37464: 26.3; Icomplete and TRAMP create unnecessary buffer

From: Andrii Kolomoiets <[email-masked]>
Date: Mon, 23 Sep 2019 09:59:33 +0300

Hi Michael,

> On Sep 21, 2019, at 12:17, Michael Albinus <[email-masked]> wrote:
> 
>> 1. emacs -Q
>> 2. M-x icomplete-mode
>> 3. C-x C-f
>> 4. /q::
>>   instead of "q" allowed method can be specified e.g. "sudo" or "ssh"
>> 5. C-g
>> 6. C-x C-b
>> 
>> Notice new buffer "*tramp/q..." created although command was cancelled.
> 
> Thanks for the report, I can confirm the behaviour. However, this is not
> a bug. Try the following command instead:
> 
> emacs -Q --eval '(setq tramp-verbose 6)'
> 
> This enables traces up to level 6, which are the commands send to a
> remote host. You will see also the buffer *debug tramp/ssh...*. No trace
> there with level 6, but entries like
> 
> 11:09:33.148026 tramp-file-name-handler (5) # Non-essential received in operation (file-name-all-completions  /ssh::)
> 
> This tells us, that Tramp hasn't tried any remote connection, because it
> is still in user name / host name completion. And that's what counts.
> 
> I'm marking this as not-a-bug, and close it. Feel free to ask if you
> need further information.
> 
> Best regards, Michael.

But why this doesn't happen when icomplete-mode is disabled?
C-x C-f /q:: <TAB> says "Method 'q' is not known" and there are
no `*tramp/q...` buffer.

Let me explain how i faced this behaviour. I have some commands that do
`(abbreviate-file-name default-directory)`. After misspelled `sudo` as
TRAMP method in `find-file` prompt like `/suod::/etc/hosts` and
cancelling command with `C-g` the buffer `*tramp/suod...` was created.
And `(abbreviate-file-name default-directory)` in that buffer leads to
"Method 'suod' is not known" error.
I thought that buffer `*tramp/suod...` was created mistakenly.
If this is expected behaviour do i need to wrap `abbreviate-file-name`
with `condition-case` or something?

Actually there are more command that won't work from the
`*tramp/suod...` buffer: vc-dir, find-file, dired.
All of them leads to "Method 'soud' is not known" error.

Thanks!