From 9d6018efece23c615039e836506a379ef98b8db4 Mon Sep 17 00:00:00 2001 From: Eric Danan Date: Thu, 15 Sep 2016 09:05:52 +0200 Subject: [PATCH] new fn: counsel-projectile-find-file-or-buffer --- counsel-projectile.el | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/counsel-projectile.el b/counsel-projectile.el index 8fae82c..b35b2c5 100644 --- a/counsel-projectile.el +++ b/counsel-projectile.el @@ -169,6 +169,17 @@ If optional argument VIRTUAL is non-nil, add project files as virtual buffers." '(("j" counsel-projectile--switch-buffer-other-window-action "other window"))) +;;; counsel-projectile-find-file-or-buffer + +;;;###autoload +(defun counsel-projectile-find-file-or-buffer (&optional arg) + "Visit a project file or buffer. + +With a prefix ARG invalidates the cache first." + (interactive) + (projectile-maybe-invalidate-cache arg) + (counsel-projectile-switch-to-buffer t)) + ;;; counsel-projectile-switch-project ;;;###autoload @@ -235,9 +246,7 @@ With a prefix ARG invokes `projectile-commander' instead of `projectile-switch-p With a prefix ARG invalidates the cache first." (interactive "P") (if (projectile-project-p) - (progn - (projectile-maybe-invalidate-cache arg) - (counsel-projectile-switch-to-buffer t)) + (counsel-projectile-find-file-or-buffer arg) (counsel-projectile-switch-project))) ;;; key bindings