emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 5a34b65: Use the term "future history" rather than "default"


From: Dmitry Gutov
Subject: master 5a34b65: Use the term "future history" rather than "default"
Date: Mon, 13 Sep 2021 17:56:34 -0400 (EDT)

branch: master
commit 5a34b65a3bfbf639a02b314efb4c9e69ba063c07
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    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.
---
 lisp/progmodes/project.el | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index d034443..b2b1a78 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -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 (suggested-filename dirs project)
+  "Complete a file name in DIRS in PROJECT and visit the result.
 
-(defun project-find-file-in (filename dirs project)
-  "Complete FILENAME 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]