Function: cider--update-project-dir
cider--update-project-dir is a byte-compiled function defined in
cider.el.
Signature
(cider--update-project-dir PARAMS)
Documentation
Update :project-dir in PARAMS.
Params is a plist with the following keys (non-exhaustive)
:edit-project-dir prompt (optional) ask user to confirm the project root
directory.
Source Code
;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider.el
(defun cider--update-project-dir (params)
"Update :project-dir in PARAMS.
Params is a plist with the following keys (non-exhaustive)
:edit-project-dir prompt (optional) ask user to confirm the project root
directory."
(let* ((params (cider--update-do-prompt params))
(proj-dir (if (or (plist-get params :do-prompt)
(plist-get params :edit-project-dir))
(read-directory-name "Project: "
(cider-project-dir (cider-current-dir)))
(plist-get params :project-dir)))
(orig-buffer (current-buffer)))
(if (or (null proj-dir)
(file-in-directory-p default-directory proj-dir))
(plist-put params :project-dir
(or proj-dir
(cider-project-dir (cider-current-dir))))
;; If proj-dir is not a parent of default-directory, transfer all
;; local variables and hack dir-local variables into a temporary
;; buffer kept on `params' for the rest of the param-update pipeline.
;; Generate a unique buffer name so that interleaved or interrupted
;; jack-ins do not stomp each other. The buffer is hidden and small;
;; it is left for Emacs to reclaim when no longer referenced.
(let ((context-buf (generate-new-buffer " *cider-context-buffer*" t)))
(with-current-buffer context-buf
(dolist (pair (buffer-local-variables orig-buffer))
(pcase pair
(`(,name . ,value) ;ignore unbound variables
(ignore-errors (set (make-local-variable name) value)))))
(setq-local buffer-file-name nil)
(let ((default-directory proj-dir))
(hack-dir-local-variables-non-file-buffer)
(thread-first params
(plist-put :project-dir proj-dir)
(plist-put :--context-buffer (current-buffer)))))))))