2

I'm using ivy-use-virtual-buffers to see both currently and recently visited buffers in Swiper's ivy-switch-buffer and it worked great until last month when I opened distant files via ssh/Tramp.

Ever since, ivy-switch-buffer errors, see below.

Questions

  • How exactly is ivy-ignore-buffers (see config below) supposed to work ? On full buffer names (w/ path)?
  • How is ivy-switch-buffer trying to connect? I can see in the error buffer that is uses some username that I don't use anymore to connect... Where are those connection details stored?
  • Why is ivy-switch-buffer trying to connect in the first place ? counsel-recentf does not do that, the distant buffers are sitting quietly in the list, and when selected, Emacs connects (using the right SSH credentials / aliases / keys) and opens the file.

Here is my configuration:

(use-package swiper
  :ensure try
  :bind
  (([f4] . ivy-switch-buffer)
   ([(control c) (f)] . counsel-ag)
   ([(control c) (g)] . counsel-git)
   ([(control c) (j)] . counsel-git-grep)
   ([(control c) (l)] . counsel-locate)
   ([(control d)] . swiper-ag)
   ([(control f)] . swiper)
   ([(control h) (control f)] . counsel-describe-function)
   ([(control h) (control v)] . counsel-describe-variable)
   ([(control o)] . counsel-find-file)
   ([(control shift o)] . counsel-recentf)
   ([f9] . counsel-rhythmbox)
   :map ivy-minibuffer-map
   ([(control f)] . ivy-yank-word)
   :map read-expression-map
   ([(control r)] . counsel-expression-history))
  :config
  (progn
    (define-key
      ivy-switch-buffer-map
      [(control w)]
      (lambda ()
        (interactive)
        (ivy-set-action 'kill-buffer)
        (ivy-done))))
  :init
  (setq  ivy-use-virtual-buffers t
         ivy-ignore-buffers '("^\\/ssh" ; doesn't seem to work
                              "\\` "
                              "\\`\\*")
         ivy-display-style 'fancy
         ivy-count-format "(%d/%d) "
         ivy-initial-inputs-alist nil
         ivy-extra-directories nil))

And the errors:

Tramp: Opening connection for [email protected] using ssh...
Tramp: Sending command ‘exec ssh -l weird_username  -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none myserver.com’
Tramp: Waiting for prompts from remote shell...
Tramp failed to connect.  If this happens repeatedly, try
    ‘M-x tramp-cleanup-this-connection’
Tramp: Waiting for prompts from remote shell...failed
Tramp: Opening connection for [email protected] using ssh...failed
tramp-file-name-handler: Tramp failed to connect.  If this happens repeatedly, try
    ‘M-x tramp-cleanup-this-connection’

1 Answer 1

2

Ok, I found this file :

# cat ~/.emacs.d/tramp
;; -*- emacs-lisp -*- <21/02/05 12:48:54 /home/xxxxxx/.emacs.d/tramp>
;; Tramp connection history.  Don't change this file.
;; You can delete it, forcing Tramp to reapply the checks.

(((tramp-file-name "ssh" nil nil "sbc" nil nil nil)
  nil)
 ((tramp-file-name "ssh" "weird_username" nil "myserver.com" nil nil nil)
  nil))

I did what it says on the tin and deleted it. Then I removed all mentions of weird_username and myserver.com in both ~/.emacs.d/history and ~/.emacs.d/recentf, and now ivy-switch-buffer works ; Phew.

Your Answer

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

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