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 /tag-emacs/emacs.d | |
parent | 664e4c099d653fed46c0970328a70fdcaf89e581 (diff) | |
download | nixfiles-d3981bdfb3ccd4603a1ea7f5d130a3b2e24ec714.tar.lz nixfiles-d3981bdfb3ccd4603a1ea7f5d130a3b2e24ec714.tar.zst nixfiles-d3981bdfb3ccd4603a1ea7f5d130a3b2e24ec714.zip |
Emacs: Fix counsel-switch-to-projectile-buffer
Fallback to `ivy-switch-buffer` if not in a project
Diffstat (limited to 'tag-emacs/emacs.d')
-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 8eae5336..32fa1963 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 |