Variable: project-prompter

project-prompter is a customizable variable defined in project.el.gz.

Value

project-prompt-project-dir

Documentation

Function to call to prompt for a project.

The function is called either with no arguments or with up to four optional arguments: (&optional PROMPT PREDICATE REQUIRE-KNOWN ALLOW-EMPTY).

PROMPT is the prompt string to use.

PREDICATE, if non-nil, is a function suitable as the PREDICATE argument to try-completion or all-completions, which see. PREDICATE allows the caller to limit the projects from which the user is able to select. It should return nil when passed a project root directory corresponding to a project the user should not be allowed to select. The project-prompter should filter project completion candidates presented to the user using this predicate.

If REQUIRE-KNOWN is non-nil, the value of project-prompter should only allow the user to select from known projects. Otherwise, the function may allow the user to input arbitrary directories. If PREDICATE and REQUIRE-KNOWN are both non-nil, the value of project-prompter should not return any project root directory for which PREDICATE returns nil.

If ALLOW-EMPTY is non-nil, then irrespective of REQUIRE-KNOWN, the user may enter nothing (i.e., just type RET). In this case the function should return "". Conventionally this is used to allow the user to select the current project. Callers should append something like " (empty for current project)" to PROMPT when passing ALLOW-EMPTY non-nil.

This variable was added, or its default value changed, in Emacs 31.1.

Probably introduced at or before Emacs version 31.1.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/project.el.gz
(defcustom project-prompter #'project-prompt-project-dir
  "Function to call to prompt for a project.
The function is called either with no arguments or with up to four
optional arguments: (&optional PROMPT PREDICATE REQUIRE-KNOWN ALLOW-EMPTY).

PROMPT is the prompt string to use.

PREDICATE, if non-nil, is a function suitable as the PREDICATE argument
to `try-completion' or `all-completions', which see.  PREDICATE allows
the caller to limit the projects from which the user is able to select.
It should return nil when passed a project root directory corresponding
to a project the user should not be allowed to select.
The `project-prompter' should filter project completion candidates
presented to the user using this predicate.

If REQUIRE-KNOWN is non-nil, the value of `project-prompter' should only
allow the user to select from known projects.  Otherwise, the function
may allow the user to input arbitrary directories.  If PREDICATE and
REQUIRE-KNOWN are both non-nil, the value of `project-prompter' should
not return any project root directory for which PREDICATE returns nil.

If ALLOW-EMPTY is non-nil, then irrespective of REQUIRE-KNOWN, the user
may enter nothing (i.e., just type RET).
In this case the function should return \"\".  Conventionally this is
used to allow the user to select the current project.
Callers should append something like \" (empty for current project)\" to
PROMPT when passing ALLOW-EMPTY non-nil."
  :type '(choice (const :tag "Prompt for a project directory"
                        project-prompt-project-dir)
                 (const :tag "Prompt for a project name"
                        project-prompt-project-name)
                 (function :tag "Custom function" nil))
  :group 'project
  :version "31.1")