Function: projectile-update-project-type
projectile-update-project-type is a byte-compiled function defined in
projectile.el.
Signature
(projectile-update-project-type PROJECT-TYPE &key PRECEDENCE (MARKER-FILES nil MARKER-FILES-SPECIFIED) (PROJECT-FILE nil PROJECT-FILE-SPECIFIED) (COMPILATION-DIR nil COMPILATION-DIR-SPECIFIED) (CONFIGURE nil CONFIGURE-SPECIFIED) (COMPILE nil COMPILE-SPECIFIED) (INSTALL nil INSTALL-SPECIFIED) (PACKAGE nil PACKAGE-SPECIFIED) (TEST nil TEST-SPECIFIED) (RUN nil RUN-SPECIFIED) (TEST-SUFFIX nil TEST-SUFFIX-SPECIFIED) (TEST-PREFIX nil TEST-PREFIX-SPECIFIED) (SRC-DIR nil SRC-DIR-SPECIFIED) (TEST-DIR nil TEST-DIR-SPECIFIED) (SRC-EXTENSION nil SRC-EXTENSION-SPECIFIED) (TEST-EXTENSION nil TEST-EXTENSION-SPECIFIED) (RELATED-FILES-FN nil RELATED-FILES-FN-SPECIFIED) (FILE-KINDS nil FILE-KINDS-SPECIFIED) (TASKS nil TASKS-SPECIFIED))
Documentation
Update an existing projectile project type.
Passed items will override existing values for the project type given
by PROJECT-TYPE. nil can be used to remove a project type attribute.
Raise an error if PROJECT-TYPE is not already registered with
projectile. This function may also take the keyword argument
PRECEDENCE which when set to high will make projectile prioritise
this project type over other clashing project types, and a value of
low will make projectile prefer (all) other project types by
default.
The remaining arguments - MARKER-FILES and the optional keyword
arguments - have the same meaning as for
projectile-register-project-type, which see.
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(cl-defun projectile-update-project-type
(project-type
&key precedence
(marker-files nil marker-files-specified)
(project-file nil project-file-specified)
(compilation-dir nil compilation-dir-specified)
(configure nil configure-specified)
(compile nil compile-specified)
(install nil install-specified)
(package nil package-specified)
(test nil test-specified)
(run nil run-specified)
(test-suffix nil test-suffix-specified)
(test-prefix nil test-prefix-specified)
(src-dir nil src-dir-specified)
(test-dir nil test-dir-specified)
(src-extension nil src-extension-specified)
(test-extension nil test-extension-specified)
(related-files-fn nil related-files-fn-specified)
(file-kinds nil file-kinds-specified)
(tasks nil tasks-specified))
"Update an existing projectile project type.
Passed items will override existing values for the project type given
by PROJECT-TYPE. nil can be used to remove a project type attribute.
Raise an error if PROJECT-TYPE is not already registered with
projectile. This function may also take the keyword argument
PRECEDENCE which when set to `high' will make projectile prioritise
this project type over other clashing project types, and a value of
`low' will make projectile prefer (all) other project types by
default.
The remaining arguments - MARKER-FILES and the optional keyword
arguments - have the same meaning as for
`projectile-register-project-type', which see."
(let* ((existing-project-plist
(or (seq-find
(lambda (p) (eq project-type (car p))) projectile-project-types)
(error "No existing project found for: %s" project-type)))
(new-plist
(append
(when marker-files-specified `(marker-files ,marker-files))
(when project-file-specified `(project-file ,project-file))
(when compilation-dir-specified `(compilation-dir ,compilation-dir))
(when configure-specified `(configure-command ,configure))
(when compile-specified `(compile-command ,compile))
(when test-specified `(test-command ,test))
(when install-specified `(install-command ,install))
(when package-specified `(package-command ,package))
(when run-specified `(run-command ,run))
(when test-suffix-specified `(test-suffix ,test-suffix))
(when test-prefix-specified `(test-prefix ,test-prefix))
(when src-dir-specified `(src-dir ,src-dir))
(when test-dir-specified `(test-dir ,test-dir))
(when src-extension-specified `(src-extension ,src-extension))
(when test-extension-specified `(test-extension ,test-extension))
(when related-files-fn-specified
`(related-files-fn ,related-files-fn))
(when file-kinds-specified `(file-kinds ,file-kinds))
(when tasks-specified `(tasks ,tasks))))
(merged-plist
(projectile--combine-plists
(cdr existing-project-plist) new-plist))
(project-type-elt (cons project-type merged-plist)))
(cl-flet* ((project-filter (p) (eq project-type (car p)))
(project-map (p) (if (project-filter p) project-type-elt p)))
(setq projectile-project-types
(if precedence
(let ((filtered-types
(seq-remove #'project-filter projectile-project-types)))
(setq projectile-project-type-cache (make-hash-table :test 'equal))
(cond ((eq precedence 'high)
(cons project-type-elt filtered-types))
((eq precedence 'low)
(append filtered-types (list project-type-elt)))
(t (error "Precedence must be one of '(high low)"))))
(mapcar #'project-map projectile-project-types))))))