From 856d429f2d0f2a95af0790452fb0e572ee770515 Mon Sep 17 00:00:00 2001 From: Akib Azmain Turja Date: Thu, 8 Dec 2022 15:58:20 +0600 Subject: [PATCH] Fix prompt annotation bug trigger when shell exits * eat.el (eat--correct-shell-prompt-mark-overlays): Make sure 'eat--terminal' is non-nil. * eat.el (eat--sentinel): Cancel timers, correct shell prompt annotations for the final time, reset shell prompt annotation related local variables. --- eat.el | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/eat.el b/eat.el index 7b99e99..65a1067 100644 --- a/eat.el +++ b/eat.el @@ -4300,6 +4300,7 @@ If HOST isn't the host Emacs is running on, don't do anything." BUFFER is the terminal buffer." (when (and (buffer-live-p buffer) + (buffer-local-value 'eat--terminal buffer) eat-enable-shell-prompt-annotation) (with-current-buffer buffer (while-no-input @@ -5001,7 +5002,21 @@ to it." (kill-buffer buffer) (with-current-buffer buffer (let ((inhibit-read-only t)) - (eat--process-output-queue (current-buffer)) + (when eat--process-output-queue-timer + (cancel-timer eat--process-output-queue-timer) + (setq eat--process-output-queue-timer nil)) + (eat--process-output-queue buffer) + (when eat--shell-prompt-annotation-correction-timer + (cancel-timer + eat--shell-prompt-annotation-correction-timer) + (setq eat--shell-prompt-annotation-correction-timer + nil)) + (when eat-enable-shell-prompt-annotation + (eat--correct-shell-prompt-mark-overlays buffer) + (setq eat--shell-command-status 0) + (setq eat--shell-prompt-begin nil) + (setq eat--shell-prompt-mark nil) + (setq eat--shell-prompt-mark-overlays nil)) (eat-emacs-mode) (setq eat--process nil) (delete-process process)