aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEshel Yaron2024-09-09 19:43:21 +0200
committerEshel Yaron2024-09-09 19:43:21 +0200
commit466db35877281ce2d5c2a5804e16d9401017d766 (patch)
treeb52bc412963cf8995d74df3a488dfb31605338cd
parent7d7aa65f63db78c5732f1580213fc3767b767a4a (diff)
downloademacs-466db35877281ce2d5c2a5804e16d9401017d766.tar.gz
emacs-466db35877281ce2d5c2a5804e16d9401017d766.zip
; 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.
-rw-r--r--lisp/progmodes/project.el21
1 files changed, 10 insertions, 11 deletions
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index ce2960c248b..ab884935a77 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1070,17 +1070,16 @@ using a command like `project-find-file'."
1070 filename)) 1070 filename))
1071 1071
1072;;;###autoload 1072;;;###autoload
1073(defun project-find-file-in-root () 1073(defun project-find-file-in-root (filename)
1074 "Call `find-file' with the current project root as `default-directory'. 1074 "Edit file FILENAME.
1075 1075
1076Unlike `project-find-file', this doesn't provide completion over the 1076Interactively, prompt for FILENAME, defaulting to the root directory of
1077entire file tree. 1077the current project."
1078 1078 (declare (interactive-only find-file))
1079This is equivalent to running `project-any-command' with `find-file'." 1079 (interactive (list (read-file-name "Find file in root: "
1080 (interactive) 1080 (project-root (project-current t)) nil
1081 (let* ((pr (project-current t)) 1081 (confirm-nonexistent-file-or-buffer))))
1082 (default-directory (project-root pr))) 1082 (find-file filename t))
1083 (call-interactively #'find-file)))
1084 1083
1085;;;###autoload 1084;;;###autoload
1086(defun project-find-file (&optional include-all) 1085(defun project-find-file (&optional include-all)