Emacs: Fix counsel-switch-to-projectile-buffer Fallback to `ivy-switch-buffer` if not in a project
Alan Pearce alan@alanpearce.co.uk
Sun, 16 Aug 2015 13:29:45 +0200
1 files changed, 8 insertions(+), 5 deletions(-)
jump to
M tag-emacs/emacs.d/init.org → tag-emacs/emacs.d/init.org
@@ -1209,11 +1209,14 @@ ("C-x b" . counsel-switch-to-projectile-buffer)) :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