1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 02:31:03 -08:00

* lisp/progmodes/project.el (project-vc-dir, project-shell): New commands.

(project-compile): Add args and interactive spec like in 'compile'.
(project-switch-commands): Bind project-vc-dir to "v",
project-shell to "s", and rebind project-find-regexp from "s" to "r".

* doc/emacs/maintaining.texi (Project File Commands):
Describe project-vc-dir and project-shell.
This commit is contained in:
Juri Linkov 2020-06-02 02:01:25 +03:00
parent 6d6ec1bc1e
commit 2c1e5b9e77
3 changed files with 44 additions and 7 deletions

View file

@ -1718,6 +1718,17 @@ continue with @w{@kbd{M-x fileloop-continue @key{RET}}}.
(@pxref{Dired}) listing the files in the current project's root (@pxref{Dired}) listing the files in the current project's root
directory. directory.
@findex project-vc-dir
The command @code{project-vc-dir} opens a VC Directory buffer
(@pxref{VC Directory Mode}) listing the version control statuses of
the files in a directory tree under the current project's
root directory.
@findex project-shell
The command @code{project-shell} starts a shell session
(@pxref{Shell}) in a new buffer with the current project's root as the
working directory.
@findex project-eshell @findex project-eshell
The command @code{project-eshell} starts an Eshell session in a new The command @code{project-eshell} starts an Eshell session in a new
buffer with the current project's root as the working directory. buffer with the current project's root as the working directory.

View file

@ -411,8 +411,8 @@ information, see the related entry about 'shr-browse-url' above.
all commands that prompt for a project directory. all commands that prompt for a project directory.
+++ +++
*** New commands 'project-dired' and 'project-eshell'. *** New commands 'project-dired', 'project-vc-dir', 'project-shell', 'project-eshell'.
These commands run Dired and Eshell in a project's root directory, These commands run Dired/VC-Dir and Shell/Eshell in a project's root directory,
respectively. respectively.
+++ +++

View file

@ -671,6 +671,20 @@ PREDICATE, HIST, and DEFAULT have the same meaning as in
(interactive) (interactive)
(dired (project-root (project-current t)))) (dired (project-root (project-current t))))
;;;###autoload
(defun project-vc-dir ()
"Open VC-Dir in the current project."
(interactive)
(vc-dir (project-root (project-current t))))
;;;###autoload
(defun project-shell ()
"Open Shell in the current project."
(interactive)
(let ((default-directory (project-root (project-current t))))
;; Use create-file-buffer to uniquify shell buffer names.
(shell (create-file-buffer "*shell*"))))
;;;###autoload ;;;###autoload
(defun project-eshell () (defun project-eshell ()
"Open Eshell in the current project." "Open Eshell in the current project."
@ -705,13 +719,23 @@ loop using the command \\[fileloop-continue]."
from to (project-files (project-current t)) 'default) from to (project-files (project-current t)) 'default)
(fileloop-continue)) (fileloop-continue))
(defvar compilation-read-command)
(declare-function compilation-read-command "compile")
;;;###autoload ;;;###autoload
(defun project-compile () (defun project-compile (command &optional comint)
"Run `compile' in the project root." "Run `compile' in the project root.
(interactive) Arguments the same as in `compile'."
(interactive
(list
(let ((command (eval compile-command)))
(if (or compilation-read-command current-prefix-arg)
(compilation-read-command command)
command))
(consp current-prefix-arg)))
(let* ((pr (project-current t)) (let* ((pr (project-current t))
(default-directory (project-root pr))) (default-directory (project-root pr)))
(call-interactively 'compile))) (compile command comint)))
;;; Project list ;;; Project list
@ -795,8 +819,10 @@ It's also possible to enter an arbitrary directory."
;;;###autoload ;;;###autoload
(defvar project-switch-commands (defvar project-switch-commands
'(("f" "Find file" project-find-file) '(("f" "Find file" project-find-file)
("s" "Find regexp" project-find-regexp) ("r" "Find regexp" project-find-regexp)
("d" "Dired" project-dired) ("d" "Dired" project-dired)
("v" "VC-Dir" project-vc-dir)
("s" "Shell" project-shell)
("e" "Eshell" project-eshell)) ("e" "Eshell" project-eshell))
"Alist mapping keys to project switching menu entries. "Alist mapping keys to project switching menu entries.
Used by `project-switch-project' to construct a dispatch menu of Used by `project-switch-project' to construct a dispatch menu of