[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/eat 153491a0a1: Query when killing buffer when command is
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/eat 153491a0a1: Query when killing buffer when command is running |
Date: |
Wed, 8 Feb 2023 09:59:06 -0500 (EST) |
branch: elpa/eat
commit 153491a0a1d3348f5dfd5cb8f896a136bdd354bb
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>
Query when killing buffer when command is running
* eat.el (eat-query-before-killing-running-terminal): New user
option.
* eat.el (eat--pre-prompt): Unset process query on exit flag if
eat-query-before-killing-running-terminal is 'auto'.
* eat.el (eat--pre-cmd): Set process query on exit flag if
eat-query-before-killing-running-terminal is 'auto'.
---
eat.el | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/eat.el b/eat.el
index 74844c4ff5..cae450895d 100644
--- a/eat.el
+++ b/eat.el
@@ -146,6 +146,17 @@ This is left disabled for security reasons."
:group 'eat-ui
:group 'eat-eshell)
+(defcustom eat-query-before-killing-running-terminal 'auto
+ "Whether to query before killing running terminal.
+
+If the value is t, always query. If the value is nil, never query.
+If the value is `auto', query if a shell command is running (shell
+integration needs to be enabled to use this properly)."
+ :type '(choice (const :tag "Yes" t)
+ (const :tag "No" nil)
+ (const :tag "If a shell command is running" auto))
+ :group 'eat-ui)
+
(defcustom eat-eshell-fallback-if-stty-not-available 'ask
"What to do if `stty' is unavailable.
@@ -4568,7 +4579,11 @@ If HOST isn't the host Emacs is running on, don't do
anything."
(defun eat--pre-prompt (_)
"Save the beginning position of shell prompt."
- (setq eat--shell-prompt-begin (point-marker)))
+ (setq eat--shell-prompt-begin (point-marker))
+ ;; FIXME: It's a crime to touch processes in this section.
+ (when (eq eat-query-before-killing-running-terminal 'auto)
+ (when (bound-and-true-p eat--process)
+ (set-process-query-on-exit-flag eat--process nil))))
(defun eat--post-prompt (_)
"Put a mark in the marginal area on current line."
@@ -4670,6 +4685,10 @@ BUFFER is the terminal buffer."
(defun eat--pre-cmd (_)
"Update shell prompt mark to indicate command is running."
+ ;; FIXME: It's a crime to touch processes in this section.
+ (when (eq eat-query-before-killing-running-terminal 'auto)
+ (when (bound-and-true-p eat--process)
+ (set-process-query-on-exit-flag eat--process t)))
(when (and eat-enable-shell-prompt-annotation
eat--shell-prompt-mark)
(setf (cadr eat--shell-prompt-mark)
@@ -5469,6 +5488,8 @@ same Eat buffer. The hook `eat-exec-hook' is run after
each exec."
:file-handler t)))
(process-put process 'adjust-window-size-function
#'eat--adjust-process-window-size)
+ (set-process-query-on-exit-flag
+ process eat-query-before-killing-running-terminal)
;; Jump to the end, and set the process mark.
(goto-char (point-max))
(set-marker (process-mark process) (point))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/eat 153491a0a1: Query when killing buffer when command is running,
ELPA Syncer <=