emacs-diffs
[Top][All Lists]
Advanced

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

master 24c06a92e9: In project-find-file and the like, add absolute file


From: Dmitry Gutov
Subject: master 24c06a92e9: In project-find-file and the like, add absolute file name to history
Date: Sat, 26 Nov 2022 07:34:22 -0500 (EST)

branch: master
commit 24c06a92e96e53438e45a9b5f7ae34647ab76643
Author: Augusto Stoffel <arstoffel@gmail.com>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    In project-find-file and the like, add absolute file name to history
    
    * lisp/progmodes/project.el (project--read-file-cpd-relative): Add
    absolute file name to history.
---
 lisp/progmodes/project.el | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 71061e6139..5b8648031f 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -947,11 +947,15 @@ by the user at will."
          (_ (when included-cpd
               (setq substrings (cons "./" substrings))))
          (new-collection (project--file-completion-table substrings))
-         (res (project--completing-read-strict prompt
-                                               new-collection
-                                               predicate
-                                               hist mb-default)))
-    (concat common-parent-directory res)))
+         (relname (let ((history-add-new-input nil))
+                    (project--completing-read-strict prompt
+                                                     new-collection
+                                                     predicate
+                                                     hist mb-default)))
+         (absname (expand-file-name relname common-parent-directory)))
+    (when (and hist history-add-new-input)
+      (add-to-history hist absname))
+    absname))
 
 (defun project--read-file-absolute (prompt
                                     all-files &optional predicate



reply via email to

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