Skip to content

Commit

Permalink
[#1242] Add some explanations to the command resolution logic
Browse files Browse the repository at this point in the history
  • Loading branch information
bbatsov committed Jul 24, 2018
1 parent 7d6d62b commit 6188f0f
Showing 1 changed file with 48 additions and 4 deletions.
52 changes: 48 additions & 4 deletions projectile.el
Original file line number Diff line number Diff line change
Expand Up @@ -3237,27 +3237,71 @@ Should be set via .dir-locals.el.")
(plist-get (gethash project-type projectile-project-types) 'run-command))

(defun projectile-configure-command (compile-dir)
"Retrieve the configure command for COMPILE-DIR."
"Retrieve the configure command for COMPILE-DIR.
The command is determined like this:
- first we check `projectile-configure-cmd-map' for the last
configure command that was invoked on the project
- then we check for `projectile-project-configure-cmd' supplied
via .dir-locals.el
- finally we check for the default configure command for a
project of that type"
(or (gethash compile-dir projectile-configure-cmd-map)
projectile-project-configure-cmd
(let ((cmd-format-string (projectile-default-configure-command (projectile-project-type))))
(when cmd-format-string
(format cmd-format-string (projectile-project-root))))))

(defun projectile-compilation-command (compile-dir)
"Retrieve the compilation command for COMPILE-DIR."
"Retrieve the compilation command for COMPILE-DIR.
The command is determined like this:
- first we check `projectile-compilation-cmd-map' for the last
compile command that was invoked on the project
- then we check for `projectile-project-compilation-cmd' supplied
via .dir-locals.el
- finally we check for the default compilation command for a
project of that type"
(or (gethash compile-dir projectile-compilation-cmd-map)
projectile-project-compilation-cmd
(projectile-default-compilation-command (projectile-project-type))))

(defun projectile-test-command (compile-dir)
"Retrieve the test command for COMPILE-DIR."
"Retrieve the test command for COMPILE-DIR.
The command is determined like this:
- first we check `projectile-test-cmd-map' for the last
test command that was invoked on the project
- then we check for `projectile-project-test-cmd' supplied
via .dir-locals.el
- finally we check for the default test command for a
project of that type"
(or (gethash compile-dir projectile-test-cmd-map)
projectile-project-test-cmd
(projectile-default-test-command (projectile-project-type))))

(defun projectile-run-command (compile-dir)
"Retrieve the run command for COMPILE-DIR."
"Retrieve the run command for COMPILE-DIR.
The command is determined like this:
- first we check `projectile-run-cmd-map' for the last
run command that was invoked on the project
- then we check for `projectile-project-run-cmd' supplied
via .dir-locals.el
- finally we check for the default run command for a
project of that type"
(or (gethash compile-dir projectile-run-cmd-map)
projectile-project-run-cmd
(projectile-default-run-command (projectile-project-type))))
Expand Down

0 comments on commit 6188f0f

Please sign in to comment.