From aa0607e1cb44b9f237ba2e5872333ed4dbb07f3e Mon Sep 17 00:00:00 2001 From: Akib Azmain Turja Date: Sun, 11 Dec 2022 14:41:38 +0600 Subject: [PATCH] Use Eshell "emacs" mode map when process is live * eat.el (eat-eshell-emacs-mode-map): Update docstring. * eat.el (eat--eshell-process-running-mode): New non-interactive minor mode. * eat.el (eat--eshell-setup-proc-and-term): Enable 'eat--eshell-process-running-mode'. * eat.el (eat--eshell-cleanup): Disable 'eat--eshell-process-running-mode'. * eat.le (eat--eshell-local-mode): Don't use 'eat-eshell-emacs-mode-map' as the mode keymap. --- eat.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/eat.el b/eat.el index 5fa1547..bf7750f 100644 --- a/eat.el +++ b/eat.el @@ -5234,7 +5234,7 @@ PROGRAM can be a shell command." (define-key map [remap eshell-toggle-direct-send] ; C-c M-d #'eat-eshell-char-mode) map) - "Keymap for Eat Eshell when no process is running.") + "Keymap for Eat Eshell \"emacs\" mode.") (defvar eat-eshell-semi-char-mode-map (let ((map (eat-term-make-keymap @@ -5260,6 +5260,11 @@ PROGRAM can be a shell command." map) "Keymap for Eat Eshell char mode.") +(define-minor-mode eat--eshell-process-running-mode + "Minor mode for \"emacs\" mode keymap when process is running." + :interactive nil + :keymap eat-eshell-emacs-mode-map) + (define-minor-mode eat--eshell-semi-char-mode "Minor mode for semi-char mode keymap." :interactive nil @@ -5381,6 +5386,7 @@ PROGRAM can be a shell command." (eat-term-redisplay eat--terminal) (setq-local eshell-output-filter-functions '(eat--eshell-output-filter)) + (eat--eshell-process-running-mode +1) (eat-eshell-semi-char-mode))) (defun eat--eshell-cleanup () @@ -5403,6 +5409,7 @@ PROGRAM can be a shell command." (kill-local-variable 'eshell-output-filter-functions) (eat--eshell-semi-char-mode -1) (eat--eshell-char-mode -1) + (eat--eshell-process-running-mode -1) (setq buffer-read-only nil)))) (declare-function eshell-output-filter "esh-mode" (process string)) @@ -5553,7 +5560,6 @@ sane 2>%s ; if [ $1 = .. ]; then shift; fi; exec \"$@\"" (define-minor-mode eat--eshell-local-mode "Toggle Eat terminal emulation is Eshell." :interactive nil - :keymap eat-eshell-emacs-mode-map (let ((locals '(cursor-type glyphless-char-display track-mouse