[PATCH v2 09/36] emacs: avoid killing process buffer when process is still alive

Subject: [PATCH v2 09/36] emacs: avoid killing process buffer when process is still alive

Date: Sun, 10 Jan 2021 15:00:45 +0100

To: notmuch@notmuchmail.org

Cc:

From: Jonas Bernoulli


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 @@ (defun notmuch-start-notmuch-sentinel (proc event)
        (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)
 
-- 
2.29.1
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: