Use the term "future history" rather than "default"
* lisp/progmodes/project.el (project-find-file, project-or-external-find-file): Update docstring. (project--read-file-cpd-relative, project--read-file-absolute) (project--completing-read-strict): Rename DEFAULT to MB-DEFAULT. (project-find-file-in): Rename FILENAME to SUGGESTED-FILENAME.
This commit is contained in:
parent
9000aeaed4
commit
5a34b65a3b
1 changed files with 21 additions and 15 deletions
|
@ -837,8 +837,8 @@ pattern to search for."
|
|||
(defun project-find-file ()
|
||||
"Visit a file (with completion) in the current project.
|
||||
|
||||
The completion default is the filename at point, determined by
|
||||
`thing-at-point' (whether such file exists or not)."
|
||||
The filename at point (determined by `thing-at-point'), if any,
|
||||
is available as part of \"future history\"."
|
||||
(interactive)
|
||||
(let* ((pr (project-current t))
|
||||
(dirs (list (project-root pr))))
|
||||
|
@ -848,8 +848,8 @@ The completion default is the filename at point, determined by
|
|||
(defun project-or-external-find-file ()
|
||||
"Visit a file (with completion) in the current project or external roots.
|
||||
|
||||
The completion default is the filename at point, determined by
|
||||
`thing-at-point' (whether such file exists or not)."
|
||||
The filename at point (determined by `thing-at-point'), if any,
|
||||
is available as part of \"future history\"."
|
||||
(interactive)
|
||||
(let* ((pr (project-current t))
|
||||
(dirs (cons
|
||||
|
@ -870,11 +870,14 @@ For the arguments list, see `project--read-file-cpd-relative'."
|
|||
|
||||
(defun project--read-file-cpd-relative (prompt
|
||||
all-files &optional predicate
|
||||
hist default)
|
||||
hist mb-default)
|
||||
"Read a file name, prompting with PROMPT.
|
||||
ALL-FILES is a list of possible file name completions.
|
||||
PREDICATE, HIST, and DEFAULT have the same meaning as in
|
||||
`completing-read'."
|
||||
|
||||
PREDICATE and HIST have the same meaning as in `completing-read'.
|
||||
|
||||
MB-DEFAULT is used as part of \"future history\", to be inserted
|
||||
by the user at will."
|
||||
(let* ((common-parent-directory
|
||||
(let ((common-prefix (try-completion "" all-files)))
|
||||
(if (> (length common-prefix) 0)
|
||||
|
@ -888,36 +891,39 @@ PREDICATE, HIST, and DEFAULT have the same meaning as in
|
|||
(res (project--completing-read-strict prompt
|
||||
new-collection
|
||||
predicate
|
||||
hist default)))
|
||||
hist mb-default)))
|
||||
(concat common-parent-directory res)))
|
||||
|
||||
(defun project--read-file-absolute (prompt
|
||||
all-files &optional predicate
|
||||
hist default)
|
||||
hist mb-default)
|
||||
(project--completing-read-strict prompt
|
||||
(project--file-completion-table all-files)
|
||||
predicate
|
||||
hist default))
|
||||
hist mb-default))
|
||||
|
||||
(defun project-find-file-in (filename dirs project)
|
||||
"Complete FILENAME in DIRS in PROJECT and visit the result."
|
||||
(defun project-find-file-in (suggested-filename dirs project)
|
||||
"Complete a file name in DIRS in PROJECT and visit the result.
|
||||
|
||||
SUGGESTED-FILENAME is a relative file name, or part of it, which
|
||||
is used as part of \"future history\"."
|
||||
(let* ((all-files (project-files project dirs))
|
||||
(completion-ignore-case read-file-name-completion-ignore-case)
|
||||
(file (funcall project-read-file-name-function
|
||||
"Find file" all-files nil nil
|
||||
filename)))
|
||||
suggested-filename)))
|
||||
(if (string= file "")
|
||||
(user-error "You didn't specify the file")
|
||||
(find-file file))))
|
||||
|
||||
(defun project--completing-read-strict (prompt
|
||||
collection &optional predicate
|
||||
hist default)
|
||||
hist mb-default)
|
||||
(minibuffer-with-setup-hook
|
||||
(lambda ()
|
||||
(setq-local minibuffer-default-add-function
|
||||
(lambda ()
|
||||
(let ((minibuffer-default default))
|
||||
(let ((minibuffer-default mb-default))
|
||||
(minibuffer-default-add-completions)))))
|
||||
(completing-read (format "%s: " prompt)
|
||||
collection predicate 'confirm
|
||||
|
|
Loading…
Add table
Reference in a new issue