From 195ba2fcd17e4292507fd8f0394276ad79e3b10d Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sun, 8 Sep 2024 14:54:14 +0200 Subject: [PATCH] ; (project-find-file-in-root): Avoid 'call-interactively'. --- lisp/progmodes/project.el | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 92617ff5176..fab8456c9d3 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -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) -- 2.39.5