aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--doc/modules/ROOT/pages/usage.adoc3
-rw-r--r--projectile.el43
3 files changed, 47 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2bbb654..feba186 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@
* Set `projectile-auto-discover` to `nil` by default.
* [#1943](https://github.com/bbatsov/projectile/pull/1943): Consider `projectile-indexing-method` to be safe as a dir-local variable if it is one of the preset values.
* [#1936](https://github.com/bbatsov/projectile/issues/1936): Do not require selecting a project when using `M-x projectile-invalidate-cache`, since there is a global cache that is also cleared by that command, even when not operating on any specific project.
+* [#1837](https://github.com/bbatsov/projectile/issues/1837): Add `eat` project terminal commands with keybindings `x x` and `x 4 x`.
## 2.9.1 (2025-02-13)
diff --git a/doc/modules/ROOT/pages/usage.adoc b/doc/modules/ROOT/pages/usage.adoc
index f342f19..e862e00 100644
--- a/doc/modules/ROOT/pages/usage.adoc
+++ b/doc/modules/ROOT/pages/usage.adoc
@@ -354,6 +354,9 @@ Here's a list of the interactive Emacs Lisp functions, provided by Projectile:
| kbd:[s-p x v]
| Start or visit a `vterm` for the project.
+| kbd:[s-p x x]
+| Start or visit an `eat` terminal for the project.
+
| kbd:[s-p ESC]
| Switch to the most recently selected Projectile buffer.
|===
diff --git a/projectile.el b/projectile.el
index a22de25..ae9232b 100644
--- a/projectile.el
+++ b/projectile.el
@@ -62,6 +62,7 @@
(defvar grep-files-aliases)
(defvar grep-find-ignored-directories)
(defvar grep-find-ignored-files)
+(defvar eat-buffer-name)
(declare-function tags-completion-table "etags")
(declare-function make-term "term")
@@ -85,6 +86,8 @@
(declare-function vterm-other-window "ext:vterm")
(declare-function vterm-send-return "ext:vterm")
(declare-function vterm-send-string "ext:vterm")
+(declare-function eat "ext:eat")
+(declare-function eat-other-window "ext:eat")
;;; Customization
@@ -4716,6 +4719,23 @@ Switch to the project specific term buffer if it already exists."
(vterm-other-window buffer)
(vterm buffer))))))
+(defun projectile--eat (&optional new-process other-window)
+ "Invoke `eat' in the project's root.
+
+Use argument NEW-PROCESS to indicate creation of a new process instead.
+Use argument OTHER-WINDOW to indicate whether the buffer should
+be displayed in a different window.
+
+Switch to the project specific eat buffer if it already exists."
+ (let* ((project (projectile-acquire-root))
+ (eat-buffer-name (projectile-generate-process-name "eat" nil project)))
+ (unless (require 'eat nil 'noerror)
+ (error "Package 'eat' is not available"))
+ (projectile-with-default-dir project
+ (if other-window
+ (eat-other-window nil new-process)
+ (eat nil new-process)))))
+
;;;###autoload
(defun projectile-run-vterm (&optional arg)
"Invoke `vterm' in the project's root.
@@ -4736,6 +4756,26 @@ Use a prefix argument ARG to indicate creation of a new process instead."
(interactive "P")
(projectile--vterm arg 'other-window))
+;;;###autoload
+(defun projectile-run-eat (&optional arg)
+ "Invoke `eat' in the project's root.
+
+Switch to the project specific eat buffer if it already exists.
+
+Use a prefix argument ARG to indicate creation of a new process instead."
+ (interactive "P")
+ (projectile--eat arg))
+
+;;;###autoload
+(defun projectile-run-eat-other-window (&optional arg)
+ "Invoke `eat' in the project's root.
+
+Switch to the project specific eat buffer if it already exists.
+
+Use a prefix argument ARG to indicate creation of a new process instead."
+ (interactive "P")
+ (projectile--eat arg 'other-window))
+
(defun projectile-files-in-project-directory (directory)
"Return a list of files in DIRECTORY."
(let* ((project (projectile-acquire-root))
@@ -6239,6 +6279,8 @@ thing shown in the mode line otherwise."
(define-key map (kbd "x g") #'projectile-run-gdb)
(define-key map (kbd "x v") #'projectile-run-vterm)
(define-key map (kbd "x 4 v") #'projectile-run-vterm-other-window)
+ (define-key map (kbd "x x") #'projectile-run-eat)
+ (define-key map (kbd "x 4 x") #'projectile-run-eat-other-window)
;; misc
(define-key map (kbd "z") #'projectile-cache-current-file)
(define-key map (kbd "<left>") #'projectile-previous-project-buffer)
@@ -6305,6 +6347,7 @@ thing shown in the mode line otherwise."
["Run ielm" projectile-run-ielm]
["Run term" projectile-run-term]
["Run vterm" projectile-run-vterm]
+ ["Run eat" projectile-run-eat]
"--"
["Run GDB" projectile-run-gdb])
("Build"