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

From: Michael Albinus <[email-masked]>
Date: Mon, 23 Sep 2019 12:53:02 +0200

Andrii Kolomoiets <[email-masked]> writes:

> Hi Michael,

Hi Andrii,

> 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.

You activate icomplete-mode for a reason. Icomplete calls (file-exists-p
"/ssh:hostname:"), after you have typed "/ssh::" (given that "hostname" is
the name of your host). Without icomplete-mode, this doesn't happen.

> 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.

Yes. But why do you call it in this buffer?

> 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?

(ignore-errors (abbreviate-file-name default-directory)) would do.

> 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.

Yes, but only if you take the buffer with the damaged
default-directory. I would try to ban such a buffer in my code.

> Thanks!

Best regards, Michael.