diff options
author | Alan Pearce | 2015-08-16 13:29:45 +0200 |
---|---|---|
committer | Alan Pearce | 2015-08-16 13:29:45 +0200 |
commit | d3981bdfb3ccd4603a1ea7f5d130a3b2e24ec714 (patch) | |
tree | 35bb6b6e9a60a4a5cb3391a71aec4b8680753f03 | |
parent | 664e4c099d653fed46c0970328a70fdcaf89e581 (diff) | |
download | dotfiles-d3981bdfb3ccd4603a1ea7f5d130a3b2e24ec714.tar.lz dotfiles-d3981bdfb3ccd4603a1ea7f5d130a3b2e24ec714.tar.zst dotfiles-d3981bdfb3ccd4603a1ea7f5d130a3b2e24ec714.zip |
Emacs: Fix counsel-switch-to-projectile-buffer
Fallback to `ivy-switch-buffer` if not in a project
-rw-r--r-- | tag-emacs/emacs.d/init.org | 13 |
1 files 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 |