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.
This commit is contained in:
Akib Azmain Turja 2022-12-08 15:58:20 +06:00
parent 58fd1b1196
commit 856d429f2d
No known key found for this signature in database
GPG key ID: 5535FCF54D88616B

17
eat.el
View file

@ -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)