branch: master commit c2788de2641347cd1ca3547e6857e0633fac169d Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
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 ()