From d3981bdfb3ccd4603a1ea7f5d130a3b2e24ec714 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 16 Aug 2015 13:29:45 +0200 Subject: Emacs: Fix counsel-switch-to-projectile-buffer Fallback to `ivy-switch-buffer` if not in a project --- tag-emacs/emacs.d/init.org | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 8eae533..32fa196 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1209,11 +1209,14 @@ replace helm and ido. :config (progn (defun counsel-switch-to-projectile-buffer (arg) "Forward to `projectile-switch-to-buffer'." - (ivy-read (format "Switch to buffer [%s]: " (projectile-project-name)) - (projectile-project-buffer-names) - :preselect (buffer-name (other-buffer (current-buffer))) - :action #'ivy--switch-buffer-action - :keymap ivy-switch-buffer-map)))) + (interactive "P") + (if (projectile-project-p) + (ivy-read (format "Switch to buffer [%s]: " (projectile-project-name)) + (projectile-project-buffer-names) + :preselect (buffer-name (other-buffer (current-buffer))) + :action #'ivy--switch-buffer-action + :keymap ivy-switch-buffer-map) + (call-interactively #'ivy-switch-buffer))))) #+END_SRC -- cgit 1.4.1