If I understand your question correctly, you may be able to code a little function that does what you need and attach it to projectile-after-switch-project-hook
. At least running magit-status
on that hook (if it's a git project), should be pretty easy to do.
EDIT: Tried it out. It interferes with projectile-switch-project-action
. Good news is that you can just use that instead.
Here's a draft:
(defun my-projectile-switch-project-action ()
(interactive)
;; test for some typical files in my projects
(ignore-errors
(let ((files '("README" "README.md" "build.gradle")))
(while files
(message "Looking for: %s" (first files))
(if (file-exists-p (first files))
(progn
(find-file-other-window (first files))
(setq files nil))
(setq files (rest files))))))
;; now run magit
(if (vc-git-responsible-p default-directory)
(magit-status)))
;; Use the function like this:
(setq projectile-switch-project-action
#'my-projectile-switch-project-action)
I hereby put above code under the GPLv2 or later in addition to StackOverflow's standard license. You can chose under which license you want to receive this code.