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

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

[elpa] master c2788de 082/399: counsel.el (counsel--switch-buffer-update


From: Oleh Krehel
Subject: [elpa] master c2788de 082/399: counsel.el (counsel--switch-buffer-update-fn): if to cond
Date: Sat, 20 Jul 2019 14:56:53 -0400 (EDT)

branch: master
commit c2788de2641347cd1ca3547e6857e0633fac169d
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    counsel.el (counsel--switch-buffer-update-fn): if to cond
---
 counsel.el | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/counsel.el b/counsel.el
index 55bebb3..22ce249 100644
--- a/counsel.el
+++ b/counsel.el
@@ -5074,16 +5074,15 @@ The buffers are those opened during a session of 
`counsel-switch-buffer'."
   (unless counsel--switch-buffer-previous-buffers
     (setq counsel--switch-buffer-previous-buffers (buffer-list)))
   (let ((current (ivy-state-current ivy-last)))
-    ;; This check is necessary, otherwise typing into the completion
-    ;; would create empty buffers.
-    (if (get-buffer current)
-        (ivy-call)
-      (if (and ivy-use-virtual-buffers (file-exists-p current))
-          (let ((buf (find-file-noselect current)))
-            (push buf counsel--switch-buffer-temporary-buffers)
-            (ivy-call))
-        (with-ivy-window
-          (switch-to-buffer (ivy-state-buffer 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)))))))
 
 ;;;###autoload
 (defun counsel-switch-buffer ()



reply via email to

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