emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 3e1e905 083/399: Fix virtual buffers in counsel-switch-buf


From: Oleh Krehel
Subject: [elpa] master 3e1e905 083/399: Fix virtual buffers in counsel-switch-buffer
Date: Sat, 20 Jul 2019 14:56:53 -0400 (EDT)

branch: master
commit 3e1e905847d0281ef7ce9f289c357aa46b9b643d
Author: Dario Gjorgjevski <address@hidden>
Commit: Oleh Krehel <address@hidden>

    Fix virtual buffers in counsel-switch-buffer
    
    We need to use `ivy--virtual-buffers' rather than `current' when
    dealing with virtual buffers.
    
    Fixes #1971
---
 counsel.el | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/counsel.el b/counsel.el
index 22ce249..450bab2 100644
--- a/counsel.el
+++ b/counsel.el
@@ -5073,16 +5073,18 @@ The buffers are those opened during a session of 
`counsel-switch-buffer'."
 (defun counsel--switch-buffer-update-fn ()
   (unless counsel--switch-buffer-previous-buffers
     (setq counsel--switch-buffer-previous-buffers (buffer-list)))
-  (let ((current (ivy-state-current ivy-last)))
-    (cond ((get-buffer current)
-           (ivy-call))
-          ((and ivy-use-virtual-buffers (file-exists-p current))
-           (let ((buf (find-file-noselect current)))
-             (push buf counsel--switch-buffer-temporary-buffers)
-             (ivy-call)))
-          (t
-           (with-ivy-window
-             (switch-to-buffer (ivy-state-buffer ivy-last)))))))
+  (let* ((current (ivy-state-current ivy-last))
+         (virtual (assoc current ivy--virtual-buffers)))
+    (cond
+      ((get-buffer current)
+       (ivy-call))
+      ((and virtual (file-exists-p (cdr virtual)))
+       (let ((buf (find-file-noselect (cdr virtual))))
+         (push buf counsel--switch-buffer-temporary-buffers)
+         (ivy-call)))
+      (t
+       (with-ivy-window
+         (switch-to-buffer (ivy-state-buffer ivy-last)))))))
 
 ;;;###autoload
 (defun counsel-switch-buffer ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]