Function: projectile--run-project-cmd
projectile--run-project-cmd is a byte-compiled function defined in
projectile.el.
Signature
(projectile--run-project-cmd COMMAND COMMAND-MAP &key SHOW-PROMPT PROMPT-PREFIX SAVE-BUFFERS USE-COMINT-MODE)
Documentation
Run a project COMMAND, typically a test- or compile command.
Cache the COMMAND for later use inside the hash-table COMMAND-MAP.
Normally you'll be prompted for a compilation command, unless
variable compilation-read-command(var)/compilation-read-command(fun). You can force the prompt
by setting SHOW-PROMPT. The prompt will be prefixed with PROMPT-PREFIX.
If SAVE-BUFFERS is non-nil save all projectile buffers before running the command.
The command actually run is returned.
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260310.858/projectile.el
(cl-defun projectile--run-project-cmd
(command command-map &key show-prompt prompt-prefix save-buffers use-comint-mode)
"Run a project COMMAND, typically a test- or compile command.
Cache the COMMAND for later use inside the hash-table COMMAND-MAP.
Normally you'll be prompted for a compilation command, unless
variable `compilation-read-command'. You can force the prompt
by setting SHOW-PROMPT. The prompt will be prefixed with PROMPT-PREFIX.
If SAVE-BUFFERS is non-nil save all projectile buffers before
running the command.
The command actually run is returned."
(let* ((project-root (projectile-acquire-root))
(default-directory (projectile-compilation-dir))
(command (projectile-maybe-read-command show-prompt
command
prompt-prefix))
(compilation-buffer-name-function compilation-buffer-name-function)
(compilation-save-buffers-predicate compilation-save-buffers-predicate))
(when command-map
(puthash default-directory command command-map)
(let ((hist (projectile--get-command-history project-root)))
(cond
((eq projectile-cmd-hist-ignoredups t)
(unless (string= (car-safe (ring-elements hist)) command)
(ring-insert hist command)))
((eq projectile-cmd-hist-ignoredups 'erase)
(let ((idx (ring-member hist command)))
(while idx
(ring-remove hist idx)
(setq idx (ring-member hist command))))
(ring-insert hist command))
(t (ring-insert hist command)))))
(when save-buffers
(save-some-buffers (not compilation-ask-about-save)
(lambda ()
(projectile-project-buffer-p (current-buffer)
project-root))))
(when projectile-per-project-compilation-buffer
(setq compilation-buffer-name-function #'projectile-compilation-buffer-name)
(setq compilation-save-buffers-predicate #'projectile-current-project-buffer-p))
(unless command
(user-error "No %scommand configured for project type `%s'"
(or prompt-prefix "") (projectile-project-type)))
(unless (file-directory-p default-directory)
(mkdir default-directory))
(projectile-run-compilation command use-comint-mode)
command))