aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToctave <octave.crespel@club.fr>2021-07-01 06:41:21 +0200
committerGitHub <noreply@github.com>2021-07-01 07:41:21 +0300
commitda08a9103b5ba3b38ef031a9627a19436eb318b5 (patch)
treec784f1c94b415ae1812b9b46b3784085f72c4b0a
parent9791a0c130f323488eb7e4fa22c0bbe7acf706d9 (diff)
Add projectile-*-use-comint-mode variables for each compilation command (#1672)
-rw-r--r--CHANGELOG.md1
-rw-r--r--doc/modules/ROOT/pages/projects.adoc13
-rw-r--r--projectile.el62
3 files changed, 66 insertions, 10 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 27d0a5b..47485c3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@
### New features
+* Add `projectile-<cmd>-use-comint-mode` variables (where `<cmd>` is `configure`, `compile`, `test`, `install`, `package`, or `run`). These enable interactive compilation buffers.
* Add `projectile-update-project-type` function for updating the properties of existing project types.
* [#1658](https://github.com/bbatsov/projectile/pull/1658): New command `projectile-reset-known-projects`.
* [#1656](https://github.com/bbatsov/projectile/pull/1656): Add support for CMake configure, build and test presets. Enabled by setting `projectile-cmake-presets` to non-nil, disabled by default.
diff --git a/doc/modules/ROOT/pages/projects.adoc b/doc/modules/ROOT/pages/projects.adoc
index 8787f00..4b1e861 100644
--- a/doc/modules/ROOT/pages/projects.adoc
+++ b/doc/modules/ROOT/pages/projects.adoc
@@ -715,6 +715,18 @@ your project, you could customize it with the following:
((nil . ((projectile-project-name . "your-project-name-here"))))
----
+By default, compilation buffers are not writable, which allows you to
+e.g. press `g` to restart the last command. Setting
+`projectile-<cmd>-use-comint-mode` (where `<cmd>` is `configure`,
+`compile`, `test`, `install`, `package`, or `run`) to a non-nil value
+allows you to make projectile compilation buffers interactive, letting
+you e.g. test a command-line program with `projectile-run-project`.
+
+[source,elisp]
+----
+(setq projectile-comint-mode t)
+----
+
== Configure a Project's Lifecycle Commands
There are a few variables that are intended to be customized via `.dir-locals.el`.
@@ -735,3 +747,4 @@ external command or an Emacs Lisp function:
----
(setq projectile-test-cmd #'custom-test-function)
----
+
diff --git a/projectile.el b/projectile.el
index 5104f5b..18d59d2 100644
--- a/projectile.el
+++ b/projectile.el
@@ -4536,11 +4536,11 @@ project of that type"
(projectile-read-command prompt default-cmd)
default-cmd))
-(defun projectile-run-compilation (cmd)
+(defun projectile-run-compilation (cmd &optional use-comint-mode)
"Run external or Elisp compilation command CMD."
(if (functionp cmd)
(funcall cmd)
- (compile cmd)))
+ (compile cmd use-comint-mode)))
(defvar projectile-project-command-history (make-hash-table :test 'equal)
"The history of last executed project commands, per project.
@@ -4554,7 +4554,7 @@ Projects are indexed by their project-root value.")
projectile-project-command-history)))
(cl-defun projectile--run-project-cmd
- (command command-map &key show-prompt prompt-prefix save-buffers)
+ (command command-map &key show-prompt prompt-prefix save-buffers use-comint-mode)
"Run a project COMMAND, typically a test- or compile command.
Cache the COMMAND for later use inside the hash-table COMMAND-MAP.
@@ -4582,9 +4582,45 @@ The command actually run is returned."
project-root))))
(unless (file-directory-p default-directory)
(mkdir default-directory))
- (projectile-run-compilation command)
+ (projectile-run-compilation command use-comint-mode)
command))
+(defcustom projectile-configure-use-comint-mode nil
+ "Make the output buffer of projectile-configure-project interactive."
+ :group 'projectile
+ :type 'boolean
+ :package-version '(projectile . "2.5.0"))
+
+(defcustom projectile-compile-use-comint-mode nil
+ "Make the output buffer of projectile-compile-project interactive."
+ :group 'projectile
+ :type 'boolean
+ :package-version '(projectile . "2.5.0"))
+
+(defcustom projectile-test-use-comint-mode nil
+ "Make the output buffer of projectile-test-project interactive."
+ :group 'projectile
+ :type 'boolean
+ :package-version '(projectile . "2.5.0"))
+
+(defcustom projectile-install-use-comint-mode nil
+ "Make the output buffer of projectile-install-project interactive."
+ :group 'projectile
+ :type 'boolean
+ :package-version '(projectile . "2.5.0"))
+
+(defcustom projectile-package-use-comint-mode nil
+ "Make the output buffer of projectile-package-project interactive."
+ :group 'projectile
+ :type 'boolean
+ :package-version '(projectile . "2.5.0"))
+
+(defcustom projectile-run-use-comint-mode nil
+ "Make the output buffer of projectile-run-project interactive."
+ :group 'projectile
+ :type 'boolean
+ :package-version '(projectile . "2.5.0"))
+
;;;###autoload
(defun projectile-configure-project (arg)
"Run project configure command.
@@ -4597,7 +4633,8 @@ with a prefix ARG."
(projectile--run-project-cmd command projectile-configure-cmd-map
:show-prompt arg
:prompt-prefix "Configure command: "
- :save-buffers t)))
+ :save-buffers t
+ :use-comint-mode projectile-configure-use-comint-mode)))
;;;###autoload
(defun projectile-compile-project (arg)
@@ -4611,7 +4648,8 @@ with a prefix ARG."
(projectile--run-project-cmd command projectile-compilation-cmd-map
:show-prompt arg
:prompt-prefix "Compile command: "
- :save-buffers t)))
+ :save-buffers t
+ :use-comint-mode projectile-compile-use-comint-mode)))
;;;###autoload
(defun projectile-test-project (arg)
@@ -4625,7 +4663,8 @@ with a prefix ARG."
(projectile--run-project-cmd command projectile-test-cmd-map
:show-prompt arg
:prompt-prefix "Test command: "
- :save-buffers t)))
+ :save-buffers t
+ :use-comint-mode projectile-test-use-comint-mode)))
;;;###autoload
(defun projectile-install-project (arg)
@@ -4639,7 +4678,8 @@ with a prefix ARG."
(projectile--run-project-cmd command projectile-install-cmd-map
:show-prompt arg
:prompt-prefix "Install command: "
- :save-buffers t)))
+ :save-buffers t
+ :use-comint-mode projectile-install-use-comint-mode)))
;;;###autoload
(defun projectile-package-project (arg)
@@ -4653,7 +4693,8 @@ with a prefix ARG."
(projectile--run-project-cmd command projectile-package-cmd-map
:show-prompt arg
:prompt-prefix "Package command: "
- :save-buffers t)))
+ :save-buffers t
+ :use-comint-mode projectile-package-use-comint-mode)))
;;;###autoload
(defun projectile-run-project (arg)
@@ -4666,7 +4707,8 @@ with a prefix ARG."
(let ((command (projectile-run-command (projectile-compilation-dir))))
(projectile--run-project-cmd command projectile-run-cmd-map
:show-prompt arg
- :prompt-prefix "Run command: ")))
+ :prompt-prefix "Run command: "
+ :use-comint-mode projectile-run-use-comint-mode)))
;;;###autoload
(defun projectile-repeat-last-command (show-prompt)