[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/eat b4d07cb474 2/9: Add shell commands run in Eat to Emacs
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/eat b4d07cb474 2/9: Add shell commands run in Eat to Emacs history |
Date: |
Tue, 6 Dec 2022 13:58:45 -0500 (EST) |
branch: elpa/eat
commit b4d07cb4740d8e3cf36e523d7d8fae70361a144e
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>
Add shell commands run in Eat to Emacs history
* eat.el (eat-enable-shell-command-history): New user option.
* eat.el (eat--set-cmd): New function.
* eat.el (eat-exec, eat--eshell-setup-proc-and-term): Call
'eat--set-cmd' when the shell reports the command being run.
---
eat.el | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/eat.el b/eat.el
index 249ee93e1d..2c2908b80a 100644
--- a/eat.el
+++ b/eat.el
@@ -151,6 +151,16 @@ to setup your shell."
:group 'eat-ui
:group 'eat-eshell)
+(defcustom eat-enable-shell-command-history t
+ "Non-nil means add shell commands to Emacs history.
+
+When non-nil, any command you run in your shell will also appear in
+the history of commands like `eat', `shell-command' and
+`async-shell-command'."
+ :type 'boolean
+ :group 'eat-ui
+ :group 'eat-eshell)
+
(defconst eat--cursor-type-value-type
(let ((cur-type
'(choice
@@ -4159,6 +4169,12 @@ If HOST isn't the host Emacs is running on, don't do
anything."
(string= host (system-name)))
(ignore-errors
(cd-absolute cwd))))
+
+(defun eat--set-cmd (_ cmd)
+ "Add CMD to `shell-command-history'."
+ (when eat-enable-shell-command-history
+ (add-to-history 'shell-command-history cmd)))
+
;;;;; Input.
@@ -4799,7 +4815,8 @@ same Eat buffer. The hook `eat-exec-hook' is run after
each exec."
(eat-term-manipulate-selection-function eat--terminal)
#'eat--manipulate-kill-ring
(eat-term-ring-bell-function eat--terminal) #'eat--bell
- (eat-term-set-cwd-function eat--terminal) #'eat--set-cwd)
+ (eat-term-set-cwd-function eat--terminal) #'eat--set-cwd
+ (eat-term-set-cmd-function eat--terminal) #'eat--set-cmd)
;; Crank up a new process.
(let* ((size (eat-term-size eat--terminal))
(process-environment
@@ -5064,7 +5081,8 @@ PROGRAM can be a shell command."
(eat-term-manipulate-selection-function eat--terminal)
#'eat--manipulate-kill-ring
(eat-term-ring-bell-function eat--terminal) #'eat--bell
- (eat-term-set-cwd-function eat--terminal) #'eat--set-cwd)
+ (eat-term-set-cwd-function eat--terminal) #'eat--set-cwd
+ (eat-term-set-cmd-function eat--terminal) #'eat--set-cmd)
(when-let* ((window (get-buffer-window nil t)))
(with-selected-window window
(eat-term-resize eat--terminal (window-max-chars-per-line)
- [nongnu] elpa/eat updated (d35864ca6b -> 693940c733), ELPA Syncer, 2022/12/06
- [nongnu] elpa/eat 693940c733 9/9: * README.org: Add shell integration instructions, ELPA Syncer, 2022/12/06
- [nongnu] elpa/eat 8188f71562 8/9: * eat-tests.el (eat-test-set-cwd): Update test, ELPA Syncer, 2022/12/06
- [nongnu] elpa/eat 62a09caef1 7/9: * eat.el (eat--t-term): Fix initial value of 'cwd', ELPA Syncer, 2022/12/06
- [nongnu] elpa/eat a04999011f 3/9: Annotate shell prompts, ELPA Syncer, 2022/12/06
- [nongnu] elpa/eat e287487b42 6/9: Document everything about shell integration, ELPA Syncer, 2022/12/06
- [nongnu] elpa/eat 2c6afa4dc0 4/9: Add shell prompt navigation commands, ELPA Syncer, 2022/12/06
- [nongnu] elpa/eat 9caa496e45 1/9: Tighter shell integration, ELPA Syncer, 2022/12/06
- [nongnu] elpa/eat b42687f146 5/9: Fix prompt navigation when annotation is disabled, ELPA Syncer, 2022/12/06
- [nongnu] elpa/eat b4d07cb474 2/9: Add shell commands run in Eat to Emacs history,
ELPA Syncer <=