Function: projectile-discard-command-cache
projectile-discard-command-cache is an autoloaded, interactive and
byte-compiled function defined in projectile.el.
Signature
(projectile-discard-command-cache)
Documentation
Discard the cached lifecycle commands for the current project.
Projectile caches the last command used for each of the configure,
compile, test, install, package, and run actions and prefers it over the
value from .dir-locals.el or the project type's default. After
editing those, run this command so the next invocation re-reads them.
Handy on after-save-hook for .dir-locals.el buffers.
This only clears the cached commands, not the command history offered at
the prompt. See also projectile-discard-root-cache.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
;;;###autoload
(defun projectile-discard-command-cache ()
"Discard the cached lifecycle commands for the current project.
Projectile caches the last command used for each of the configure,
compile, test, install, package, and run actions and prefers it over the
value from `.dir-locals.el' or the project type's default. After
editing those, run this command so the next invocation re-reads them.
Handy on `after-save-hook' for `.dir-locals.el' buffers.
This only clears the cached commands, not the command history offered at
the prompt. See also `projectile-discard-root-cache'."
(interactive)
(let ((root (projectile-acquire-root)))
(dolist (descriptor projectile--lifecycle-phases)
(let ((command-map (symbol-value (plist-get descriptor :cmd-map))))
(dolist (dir (hash-table-keys command-map))
(when (string-prefix-p root dir)
(remhash dir command-map)))))
;; Give feedback when invoked interactively; stay quiet when used
;; programmatically (e.g. from `after-save-hook') unless verbose.
(if (called-interactively-p 'interactive)
(message "Discarded the command cache for %s" root)
(projectile--message "Discarded the command cache for %s" root))))