Function: project-prompt-project-dir

project-prompt-project-dir is a byte-compiled function defined in project.el.gz.

Signature

(project-prompt-project-dir)

Documentation

Prompt the user for a directory that is one of the known project roots.

The project is chosen among projects known from the project list, see project-list-file. It's also possible to enter an arbitrary directory not in the list.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/project.el.gz
(defun project-prompt-project-dir ()
  "Prompt the user for a directory that is one of the known project roots.
The project is chosen among projects known from the project list,
see `project-list-file'.
It's also possible to enter an arbitrary directory not in the list."
  (project--ensure-read-project-list)
  (let* ((dir-choice "... (choose a dir)")
         (choices
          ;; XXX: Just using this for the category (for the substring
          ;; completion style).
          (project--file-completion-table
           (append project--list `(,dir-choice))))
         (project--dir-history (project-known-project-roots))
         (pr-dir ""))
    (while (equal pr-dir "")
      ;; If the user simply pressed RET, do this again until they don't.
      (setq pr-dir
            (let (history-add-new-input)
              (completing-read "Select project: " choices nil t nil 'project--dir-history))))
    (if (equal pr-dir dir-choice)
        (read-directory-name "Select directory: " default-directory nil t)
      pr-dir)))