Function: project-current
project-current is an autoloaded and byte-compiled function defined in
project.el.gz.
Signature
(project-current &optional MAYBE-PROMPT DIRECTORY)
Documentation
Return the project instance in DIRECTORY, defaulting to default-directory.
When no project is found in that directory, the result depends on the value of MAYBE-PROMPT: if it is nil or omitted, return nil, else ask the user for a directory in which to look for the project, and if no project is found there, return a "transient" project instance.
The "transient" project instance is a special kind of value
which denotes a project rooted in that directory and includes all
the files under the directory except for those that match entries
in vc-directory-exclusion-list or grep-find-ignored-files.
See the doc string of project-find-functions for the general form
of the project instance object.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/project.el.gz
;;;###autoload
(defun project-current (&optional maybe-prompt directory)
"Return the project instance in DIRECTORY, defaulting to `default-directory'.
When no project is found in that directory, the result depends on
the value of MAYBE-PROMPT: if it is nil or omitted, return nil,
else ask the user for a directory in which to look for the
project, and if no project is found there, return a \"transient\"
project instance.
The \"transient\" project instance is a special kind of value
which denotes a project rooted in that directory and includes all
the files under the directory except for those that match entries
in `vc-directory-exclusion-list' or `grep-find-ignored-files'.
See the doc string of `project-find-functions' for the general form
of the project instance object."
(unless directory (setq directory (or project-current-directory-override
default-directory)))
(let ((pr (project--find-in-directory directory)))
(cond
(pr)
((unless project-current-directory-override
maybe-prompt)
(setq directory (project-prompt-project-dir)
pr (project--find-in-directory directory))))
(when maybe-prompt
(if pr
(project-remember-project pr)
(project--remove-from-project-list
directory "Project `%s' not found; removed from list")
(setq pr (cons 'transient directory))))
pr))