[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/eat fc195410e4 1/7: Ask if 'stty' is unavailable in Eshell
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/eat fc195410e4 1/7: Ask if 'stty' is unavailable in Eshell |
Date: |
Thu, 15 Dec 2022 10:58:37 -0500 (EST) |
branch: elpa/eat
commit fc195410e4de095cabaaa7a0b9bad32c536e4b06
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>
Ask if 'stty' is unavailable in Eshell
* eat.el (eat-eshell-fallback-if-stty-not-available): New user
option.
* eat.el (eat--eshell-adjust-make-process-args): If 'stty' is
not available, use 'eat-eshell-fallback-if-stty-not-available'
to determine whether to continue terminal emulation or not.
---
eat.el | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/eat.el b/eat.el
index ffa25017ae..8063979e24 100644
--- a/eat.el
+++ b/eat.el
@@ -140,6 +140,23 @@ This is left disabled for security reasons."
:group 'eat-ui
:group 'eat-eshell)
+(defcustom eat-eshell-fallback-if-stty-not-available 'ask
+ "What to do if `stty' is unavailable.
+
+`stty' is a dependency to setup terminal. If `stty' is unavailable,
+Eat won't be able to setup terminal, so any input won't be visible.
+
+The value should be any of the following:
+
+nil Do nothing.
+t Fallback to plain Eshell if `stty' is not available.
+`ask' Ask what to do.
+FUNCTION Call FUNCTION with the command and arguments (using
+ `apply') and fallback to plain Eshell if it returns
+ nil."
+ :type 'boolean
+ :group 'eat-eshell)
+
(defcustom eat-enable-directory-tracking t
"Non-nil means do directory tracking.
@@ -5489,6 +5506,7 @@ PROGRAM can be a shell command."
(eat--eshell-cleanup))))
(eshell-sentinel process message))
+(declare-function eshell-search-path "esh-ext" (name))
(defvar eshell-current-subjob-p) ; In `esh-proc'.
;; HACK: This is a dirty hack, it can break easily.
@@ -5498,7 +5516,16 @@ PROGRAM can be a shell command."
Call FN with COMMAND and ARGS, and whenever `make-process' is called,
modify its argument to change the filter, the sentinel and invoke
`stty' from the new process."
- (if eshell-current-subjob-p
+ (if (or eshell-current-subjob-p
+ (and (not (eshell-search-path "stty"))
+ (pcase eat-eshell-fallback-if-stty-not-available
+ ('nil nil)
+ ('t t)
+ ('ask (not (y-or-n-p "The program stty can't be \
+found, input won't be shown if terminal emulation is enabled. \
+Disable terminal emulation?")))
+ ((and (pred functionp) function)
+ (apply function command args)))))
(funcall fn command args)
(cl-letf*
(;; For Emacs 29 and above.
- [nongnu] elpa/eat updated (8fce5fe928 -> 61695d9671), ELPA Syncer, 2022/12/15
- [nongnu] elpa/eat f912425fb4 6/7: Fix handling non-interactive processes in Eshell, ELPA Syncer, 2022/12/15
- [nongnu] elpa/eat fc195410e4 1/7: Ask if 'stty' is unavailable in Eshell,
ELPA Syncer <=
- [nongnu] elpa/eat 162ec61f3d 3/7: Remove invisible spaces when killing text, ELPA Syncer, 2022/12/15
- [nongnu] elpa/eat 35df1bc2a4 2/7: Refactor 'eat--eshell-adjust-make-process-args', ELPA Syncer, 2022/12/15
- [nongnu] elpa/eat 559c9c362c 4/7: Refactor 'eat--eshell-adjust-make-process-args', ELPA Syncer, 2022/12/15
- [nongnu] elpa/eat e597bcfbb2 5/7: Don't use '.*-char-property-.*' functions, ELPA Syncer, 2022/12/15
- [nongnu] elpa/eat 61695d9671 7/7: Decrease regexp usage while parsing output, ELPA Syncer, 2022/12/15