; Revise new command 'project-find-file-in-root'

* lisp/progmodes/project.el (project-find-file-in-root):
Call 'find-file' directly, not via 'call-interactively'.
Move interactive behavior to 'interactive' spec.
This commit is contained in:
Eshel Yaron 2024-09-09 19:43:21 +02:00
parent 7d7aa65f63
commit 466db35877
No known key found for this signature in database
GPG key ID: EF3EE9CA35D78618

View file

@ -1070,17 +1070,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."
(declare (interactive-only find-file))
(interactive (list (read-file-name "Find file in root: "
(project-root (project-current t)) nil
(confirm-nonexistent-file-or-buffer))))
(find-file filename t))
;;;###autoload
(defun project-find-file (&optional include-all)