emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/vc-hgcmd 4c6b2e7 32/87: Kill process buffer when proces


From: Stefan Monnier
Subject: [elpa] externals/vc-hgcmd 4c6b2e7 32/87: Kill process buffer when process terminates
Date: Sat, 5 Jun 2021 16:11:41 -0400 (EDT)

branch: externals/vc-hgcmd
commit 4c6b2e764c951041ff2c9cef0eda7bbd4a2d7a62
Author: muffinmad <andreyk.mad@gmail.com>
Commit: muffinmad <andreyk.mad@gmail.com>

    Kill process buffer when process terminates
---
 vc-hgcmd.el | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/vc-hgcmd.el b/vc-hgcmd.el
index 348a49a..dbbb455 100644
--- a/vc-hgcmd.el
+++ b/vc-hgcmd.el
@@ -230,6 +230,13 @@ Insert output to process buffer and check if amount of 
data is enought to parse
                               (t (error (format "unknown channel %c\n" 
channel)))))))
                   t))))))))
 
+(defun vc-hgcmd--cmdserver-process-sentinel (process _event)
+  "Will listen for PROCESS events and kill process buffer if process killed."
+  (unless (process-live-p process)
+    (let ((buffer (process-buffer process)))
+      (when (buffer-live-p buffer)
+        (kill-buffer buffer)))))
+
 (defun vc-hgcmd--check-buffer-process (buffer)
   "Create hg cmdserver process in BUFFER if needed."
   (unless (get-buffer-process buffer)
@@ -261,6 +268,7 @@ Insert output to process buffer and check if amount of data 
is enought to parse
               ;; send \n after command data so tty process can read data
               (process-send-string process "runcommand\n")
               (set-process-filter process #'vc-hgcmd--cmdserver-process-filter)
+              (set-process-sentinel process 
#'vc-hgcmd--cmdserver-process-sentinel)
               process)))))))
 
 (defun vc-hgcmd--repo-dir ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]