diff options
| author | Juri Linkov | 2020-06-02 02:01:25 +0300 |
|---|---|---|
| committer | Juri Linkov | 2020-06-02 02:01:25 +0300 |
| commit | 2c1e5b9e77d5da26cfb01917c25546e776c67789 (patch) | |
| tree | 7a816dc41c678c9493415c4004419aa75c18599f | |
| parent | 6d6ec1bc1e784af786cc0436f54211095bf7a952 (diff) | |
| download | emacs-2c1e5b9e77d5da26cfb01917c25546e776c67789.tar.gz emacs-2c1e5b9e77d5da26cfb01917c25546e776c67789.zip | |
* 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.
| -rw-r--r-- | doc/emacs/maintaining.texi | 11 | ||||
| -rw-r--r-- | etc/NEWS | 4 | ||||
| -rw-r--r-- | lisp/progmodes/project.el | 36 |
3 files changed, 44 insertions, 7 deletions
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 22b7639d349..cc7415e7ad5 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi | |||
| @@ -1718,6 +1718,17 @@ continue with @w{@kbd{M-x fileloop-continue @key{RET}}}. | |||
| 1718 | (@pxref{Dired}) listing the files in the current project's root | 1718 | (@pxref{Dired}) listing the files in the current project's root |
| 1719 | directory. | 1719 | directory. |
| 1720 | 1720 | ||
| 1721 | @findex project-vc-dir | ||
| 1722 | The command @code{project-vc-dir} opens a VC Directory buffer | ||
| 1723 | (@pxref{VC Directory Mode}) listing the version control statuses of | ||
| 1724 | the files in a directory tree under the current project's | ||
| 1725 | root directory. | ||
| 1726 | |||
| 1727 | @findex project-shell | ||
| 1728 | The command @code{project-shell} starts a shell session | ||
| 1729 | (@pxref{Shell}) in a new buffer with the current project's root as the | ||
| 1730 | working directory. | ||
| 1731 | |||
| 1721 | @findex project-eshell | 1732 | @findex project-eshell |
| 1722 | The command @code{project-eshell} starts an Eshell session in a new | 1733 | The command @code{project-eshell} starts an Eshell session in a new |
| 1723 | buffer with the current project's root as the working directory. | 1734 | buffer with the current project's root as the working directory. |
| @@ -411,8 +411,8 @@ information, see the related entry about 'shr-browse-url' above. | |||
| 411 | all commands that prompt for a project directory. | 411 | all commands that prompt for a project directory. |
| 412 | 412 | ||
| 413 | +++ | 413 | +++ |
| 414 | *** New commands 'project-dired' and 'project-eshell'. | 414 | *** New commands 'project-dired', 'project-vc-dir', 'project-shell', 'project-eshell'. |
| 415 | These commands run Dired and Eshell in a project's root directory, | 415 | These commands run Dired/VC-Dir and Shell/Eshell in a project's root directory, |
| 416 | respectively. | 416 | respectively. |
| 417 | 417 | ||
| 418 | +++ | 418 | +++ |
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 2d0b6c4a21b..12149806891 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el | |||
| @@ -672,6 +672,20 @@ PREDICATE, HIST, and DEFAULT have the same meaning as in | |||
| 672 | (dired (project-root (project-current t)))) | 672 | (dired (project-root (project-current t)))) |
| 673 | 673 | ||
| 674 | ;;;###autoload | 674 | ;;;###autoload |
| 675 | (defun project-vc-dir () | ||
| 676 | "Open VC-Dir in the current project." | ||
| 677 | (interactive) | ||
| 678 | (vc-dir (project-root (project-current t)))) | ||
| 679 | |||
| 680 | ;;;###autoload | ||
| 681 | (defun project-shell () | ||
| 682 | "Open Shell in the current project." | ||
| 683 | (interactive) | ||
| 684 | (let ((default-directory (project-root (project-current t)))) | ||
| 685 | ;; Use ‘create-file-buffer’ to uniquify shell buffer names. | ||
| 686 | (shell (create-file-buffer "*shell*")))) | ||
| 687 | |||
| 688 | ;;;###autoload | ||
| 675 | (defun project-eshell () | 689 | (defun project-eshell () |
| 676 | "Open Eshell in the current project." | 690 | "Open Eshell in the current project." |
| 677 | (interactive) | 691 | (interactive) |
| @@ -705,13 +719,23 @@ loop using the command \\[fileloop-continue]." | |||
| 705 | from to (project-files (project-current t)) 'default) | 719 | from to (project-files (project-current t)) 'default) |
| 706 | (fileloop-continue)) | 720 | (fileloop-continue)) |
| 707 | 721 | ||
| 722 | (defvar compilation-read-command) | ||
| 723 | (declare-function compilation-read-command "compile") | ||
| 724 | |||
| 708 | ;;;###autoload | 725 | ;;;###autoload |
| 709 | (defun project-compile () | 726 | (defun project-compile (command &optional comint) |
| 710 | "Run `compile' in the project root." | 727 | "Run `compile' in the project root. |
| 711 | (interactive) | 728 | Arguments the same as in `compile'." |
| 729 | (interactive | ||
| 730 | (list | ||
| 731 | (let ((command (eval compile-command))) | ||
| 732 | (if (or compilation-read-command current-prefix-arg) | ||
| 733 | (compilation-read-command command) | ||
| 734 | command)) | ||
| 735 | (consp current-prefix-arg))) | ||
| 712 | (let* ((pr (project-current t)) | 736 | (let* ((pr (project-current t)) |
| 713 | (default-directory (project-root pr))) | 737 | (default-directory (project-root pr))) |
| 714 | (call-interactively 'compile))) | 738 | (compile command comint))) |
| 715 | 739 | ||
| 716 | 740 | ||
| 717 | ;;; Project list | 741 | ;;; Project list |
| @@ -795,8 +819,10 @@ It's also possible to enter an arbitrary directory." | |||
| 795 | ;;;###autoload | 819 | ;;;###autoload |
| 796 | (defvar project-switch-commands | 820 | (defvar project-switch-commands |
| 797 | '(("f" "Find file" project-find-file) | 821 | '(("f" "Find file" project-find-file) |
| 798 | ("s" "Find regexp" project-find-regexp) | 822 | ("r" "Find regexp" project-find-regexp) |
| 799 | ("d" "Dired" project-dired) | 823 | ("d" "Dired" project-dired) |
| 824 | ("v" "VC-Dir" project-vc-dir) | ||
| 825 | ("s" "Shell" project-shell) | ||
| 800 | ("e" "Eshell" project-eshell)) | 826 | ("e" "Eshell" project-eshell)) |
| 801 | "Alist mapping keys to project switching menu entries. | 827 | "Alist mapping keys to project switching menu entries. |
| 802 | Used by `project-switch-project' to construct a dispatch menu of | 828 | Used by `project-switch-project' to construct a dispatch menu of |