GNU bug report logs - #70996
project-find-file defaults

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Fri, 17 May 2024 06:53:01 UTC

Severity: normal

Fixed in version 30.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Juri Linkov <juri <at> linkov.net>, 70996 <at> debbugs.gnu.org
Subject: bug#70996: project-find-file defaults
Date: Sat, 8 Jun 2024 03:28:48 +0300
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





This bug report was last modified 1 year and 36 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.