[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#37464: 26.3; Icomplete and TRAMP create unnecessary buffer
From: |
Andrii Kolomoiets |
Subject: |
bug#37464: 26.3; Icomplete and TRAMP create unnecessary buffer |
Date: |
Mon, 23 Sep 2019 14:46:06 +0300 |
> Hi Andrii,
Hi 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.
>
> 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 use buffers in Ibuffer grouped by project or default-directory.
Group name is abbreviated default directory of the buffer if there are no
project.
Also I have a command to switch to buffer which is belong to current project.
It call file-in-directory-p on every buffer's default-directory in order to
determine
that the buffer belongs to project.
>> 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.
Got it.
>> 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.
>
> Best regards, Michael.
Thanks again, Michael.