bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#70996: project-find-file defaults


From: Dmitry Gutov
Subject: bug#70996: project-find-file defaults
Date: Sat, 8 Jun 2024 03:28:48 +0300
User-agent: Mozilla Thunderbird

Hi Juri,

On 17/05/2024 09:36, Juri Linkov wrote:
But the problem is that in this case it drops the current file name
as the default value that is also useful in many cases.

Fortunately, the minibuffer supports a list of default values,
like in the following patch:

This seems like a good idea, except it reverses the priority: previously, if file-at-point was present, it would be the default, not the current file name.

So how about this?

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 8a8b4fc33d6..b855dcd4546 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1080,9 +1080,9 @@ project-find-file
          (dirs (list root))
          (project-files-relative-names t))
     (project-find-file-in
-     (delq nil (list (and buffer-file-name (project--find-default-from
-                                            buffer-file-name pr))
-                     (thing-at-point 'filename)))
+     (delq nil (list (thing-at-point 'filename)
+                     (and buffer-file-name (project--find-default-from
+                                            buffer-file-name pr))))
      dirs pr include-all)))

 ;;;###autoload
@@ -1104,9 +1104,9 @@ project-or-external-find-file
                 (project-external-roots pr)))
          (project-file-history-behavior t))
     (project-find-file-in
-     (delq nil (list (and buffer-file-name (project--find-default-from
-                                            buffer-file-name pr))
-                     (thing-at-point 'filename)))
+     (delq nil (list (thing-at-point 'filename)
+                     (and buffer-file-name (project--find-default-from
+                                            buffer-file-name pr))))
      dirs pr include-all)))

(defcustom project-read-file-name-function #'project--read-file-cpd-relative






reply via email to

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