From adc123e4fd6384fba0165ebddc99d4323f6bee73 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Sun, 10 Jan 2021 15:00:45 +0100 Subject: [PATCH] emacs: avoid killing process buffer when process is still alive In practice this probably does not make a difference or we would have heard about it many times, but better be safe than sorry. Process sentinels are called not only when the process has finished but also on other state changes. --- emacs/notmuch-lib.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index e09912d3..0e235fa3 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -960,9 +960,10 @@ status." (message "%s" (error-message-string err)))))) (defun notmuch-start-notmuch-error-sentinel (proc event) - (let ((buffer (process-buffer proc))) - (when (buffer-live-p buffer) - (kill-buffer buffer)))) + (unless (process-live-p proc) + (let ((buffer (process-buffer proc))) + (when (buffer-live-p buffer) + (kill-buffer buffer))))) (defvar-local notmuch-show-process-crypto nil)