I'm using Emacs 25.3.1 with Spacemacs 0.200.9. I have Ivy installed.

At some point in the past, I opened a Tramp session to a local machine over SSH.

Now, when I'm not on that network and I try to switch buffers (C-xb), I get a spinner

Waiting for prompts from remote shell...

and (after I C-g or it times out) I get booted back with my ivy-switch-buffer command aborted.

Tramp prompts me to tramp-cleanup-this-connection. I can see the connection listed in tramp-cleanup-connection but I can't figure out how to actually remove it from history. I assume Ivy or ido or someone is keeping additional history, but I haven't been able to find it.

How can I actually remove this Tramp connection from history? Moreover, what's a good way to figure out who's responsible for asking Tramp to connect here?

  • Ivy is independent of Ido, so unless you use the latter and see the same behaviour then, there is no reason to conflate it. Ivy does not keep TRAMP history, but it does inspect buffers when calling ivy-switch-buffer, so the issue could be arising when Ivy tries to inspect (e.g. get the buffer-name) of some stale TRAMP buffer. In other words, the issue is either TRAMP-specific or it lies with Ivy not handling TRAMP buffers in an ideal manner.
    – Basil
    Commented Oct 26, 2017 at 11:04
  • (Disclaimer: I am not familiar with TRAMP internals so take my previous comment as speculation.)
    – Basil
    Commented Oct 26, 2017 at 11:06
  • ivy history is in variable ivy-history. ido history is in variables ido-file-history and ido-buffer-history. Check them. Commented Oct 26, 2017 at 13:30
  • 1
    @MichaelAlbinus I don't think OP is referring completion history, rather artefacts of TRAMP connections, but I could be wrong so it would be better if they clarified.
    – Basil
    Commented Oct 26, 2017 at 14:37
  • Well, I guess my main question is how to even get a better handle on what's going on. I don't have a live TRAMP connection (because the target machine is unreachable and I've restarted Emacs). The prompt only seems to happen when changing buffers. So either TRAMP does something when I try to list buffers or Ivy calls TRAMP. Commented Oct 26, 2017 at 20:08

1 Answer 1


Posting because I had the same problem: If ivy-use-virtual-buffers is set to t, as is recommended by the manual, Ivy creates a buffer list that includes "virtual buffers", bookmarks being one of them. In my case, I had a remote directory set as a bookmark location. In the process of processing this bookmark location, Ivy ends up calling get-file-buffer, which results in a call to tramp. (The default binding to see a list of your bookmarks is C-x r l).

You can check if virtual buffers are the issue in your case by running (ivy--virtual-buffers) (i.e., with M-x eval-expression) and seeing if Tramp attempts to connect.

I've worked around this issue by changing my configuration to:

(setq ivy-use-virtual-buffers 'recentf)

to disable Ivy from checking my bookmarks. Alternatively, you can turn the feature completely off by setting the value to nil.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.