]> git.eshelyaron.com Git - emacs.git/commitdiff
In project-find-file and the like, add absolute file name to history
authorAugusto Stoffel <arstoffel@gmail.com>
Tue, 11 Oct 2022 18:21:34 +0000 (20:21 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Sat, 26 Nov 2022 12:34:11 +0000 (14:34 +0200)
* lisp/progmodes/project.el (project--read-file-cpd-relative): Add
absolute file name to history.

lisp/progmodes/project.el

index 71061e6139d99d0d284b543e8d590d5ebed65be1..5b8648031fbb06b18c3d1929753ad38353c762fe 100644 (file)
@@ -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