]> git.eshelyaron.com Git - emacs.git/commitdiff
; (project-find-file-in-root): Avoid 'call-interactively'.
authorEshel Yaron <me@eshelyaron.com>
Sun, 8 Sep 2024 12:54:14 +0000 (14:54 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sun, 8 Sep 2024 12:54:14 +0000 (14:54 +0200)
lisp/progmodes/project.el

index 92617ff51767c9c25dabe83b50ecdacdbc7b3750..fab8456c9d3088ce09f60a35420976ed181b2554 100644 (file)
@@ -1073,17 +1073,16 @@ using a command like `project-find-file'."
     filename))
 
 ;;;###autoload
-(defun project-find-file-in-root ()
-  "Call `find-file' with the current project root as `default-directory'.
+(defun project-find-file-in-root (filename)
+  "Edit file FILENAME.
 
-Unlike `project-find-file', this doesn't provide completion over the
-entire file tree.
-
-This is equivalent to running `project-any-command' with `find-file'."
-  (interactive)
-  (let* ((pr (project-current t))
-         (default-directory (project-root pr)))
-    (call-interactively #'find-file)))
+Interactively, prompt for FILENAME, defaulting to the root directory of
+the current project."
+  (interactive
+   (list (read-file-name "Find file in project: "
+                         (project-root (project-current t)) nil
+                         (confirm-nonexistent-file-or-buffer))))
+  (find-file filename t))
 
 ;;;###autoload
 (defun project-find-file (&optional include-all)