[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 8d3160e: Add commands to run shell commands in project root
From: |
Stefan Kangas |
Subject: |
master 8d3160e: Add commands to run shell commands in project root |
Date: |
Fri, 28 Aug 2020 13:29:58 -0400 (EDT) |
branch: master
commit 8d3160ec0856dba42ac39296e7191a51c1e8b7e8
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>
Add commands to run shell commands in project root
* lisp/progmodes/project.el (project-async-shell-command)
(project-shell-command): New commands to run 'async-shell-command'
and 'shell-command' in project's root directory.
(project-prefix-map): Bind commands to '!' and '&'.
* doc/emacs/maintaining.texi (Project File Commands): Document the
new commands.
* etc/NEWS: Announce the new commands.
---
doc/emacs/maintaining.texi | 14 ++++++++++++++
etc/NEWS | 5 +++++
lisp/progmodes/project.el | 16 ++++++++++++++++
3 files changed, 35 insertions(+)
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index 9f550b4..a9b0da5 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -1693,6 +1693,12 @@ Start Eshell in the current project's root directory
@item C-x p c
Run compilation in the current project's root directory
(@code{project-compile}).
+@item C-x p !
+Run shell command in the current project's root directory
+(@code{project-shell-command}).
+@item C-x p &
+Run shell command asynchronously in the current project's root
+directory (@code{project-async-shell-command}).
@end table
Emacs provides commands for handling project files conveniently.
@@ -1770,6 +1776,14 @@ directory. @xref{Top,Eshell,Eshell, eshell, Eshell: The
Emacs Shell}.
The command @kbd{C-x p c} (@code{project-compile}) runs compilation
(@pxref{Compilation}) in the current project's root directory.
+@findex project-shell-command
+ The command @kbd{C-x p !} (@code{project-shell-command}) runs
+@code{shell-command} in the current project's root directory.
+
+@findex project-async-shell-command
+ The command @kbd{C-x p &} (@code{project-async-shell-command}) runs
+@code{async-shell-command} in the current project's root directory.
+
@node Project Buffer Commands
@subsection Project Commands That Operate on Buffers
diff --git a/etc/NEWS b/etc/NEWS
index 964b626..658e2a3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -779,6 +779,11 @@ This command lets you "switch" to another project and run
a project
command chosen from a dispatch menu.
+++
+*** New commands 'project-shell-command' and 'project-async-shell-command'.
+These commands run 'shell-command' and 'async-shell-command' in a
+project's root directory, respectively.
+
++++
*** New user option 'project-list-file'.
** json.el
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 8afd5ce..4fae3e9 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -581,6 +581,8 @@ DIRS must contain directory names."
;;;###autoload
(defvar project-prefix-map
(let ((map (make-sparse-keymap)))
+ (define-key map "!" 'project-shell-command)
+ (define-key map "&" 'project-async-shell-command)
(define-key map "f" 'project-find-file)
(define-key map "F" 'project-or-external-find-file)
(define-key map "b" 'project-switch-to-buffer)
@@ -882,6 +884,20 @@ if one already exists."
(pop-to-buffer eshell-buffer)
(eshell t))))
+;;;###autoload
+(defun project-async-shell-command ()
+ "Run `async-shell-command' in the current project's root directory."
+ (interactive)
+ (let ((default-directory (project-root (project-current t))))
+ (call-interactively #'async-shell-command)))
+
+;;;###autoload
+(defun project-shell-command ()
+ "Run `shell-command' in the current project's root directory."
+ (interactive)
+ (let ((default-directory (project-root (project-current t))))
+ (call-interactively #'shell-command)))
+
(declare-function fileloop-continue "fileloop" ())
;;;###autoload
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 8d3160e: Add commands to run shell commands in project root,
Stefan Kangas <=