Function: projectile-repeat-last-command
projectile-repeat-last-command is an autoloaded, interactive and
byte-compiled function defined in projectile.el.
Signature
(projectile-repeat-last-command SHOW-PROMPT)
Documentation
Run last projectile external command.
External commands are: projectile-configure-project,
projectile-compile-project, projectile-test-project,
projectile-install-project, projectile-package-project,
projectile-run-project and the named tasks run via
projectile-run-task (which also feed the combined history this
command reads).
If the prefix argument SHOW-PROMPT is non nil, the command can be edited.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
;;; Tasks, and repeating what you ran last
;;
;; Tasks are the commands a project's own tooling defines - npm scripts,
;; rake tasks, a Makefile's targets - discovered rather than configured.
;; `projectile-repeat-last-command' sits here too: it re-runs the last
;; command of any kind, lifecycle phase or task alike.
;;;###autoload
(defun projectile-repeat-last-command (show-prompt)
"Run last projectile external command.
External commands are: `projectile-configure-project',
`projectile-compile-project', `projectile-test-project',
`projectile-install-project', `projectile-package-project',
`projectile-run-project' and the named tasks run via
`projectile-run-task' (which also feed the combined history this
command reads).
If the prefix argument SHOW-PROMPT is non nil, the command can be edited."
(interactive "P")
(let* ((project-root (projectile-acquire-root))
(command-history (projectile--get-command-history project-root))
(command (car-safe (ring-elements command-history)))
(compilation-read-command show-prompt)
executed-command)
(unless command
(user-error "No command has been run yet for this project"))
(setq executed-command
(projectile--run-project-cmd command
nil
:save-buffers t
:prompt-prefix "Execute command: "))
;; `command-map' is nil above, so `projectile--run-project-cmd' doesn't
;; record anything; we record here instead. This command is
;; type-agnostic (it repeats the last command of any type), so it only
;; updates the combined history, not the per-type ones.
(unless (string= command executed-command)
(ring-insert command-history executed-command))))