emacs-diffs
[Top][All Lists]
Advanced

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

master ffe12ff250: Clean up more robustly in compile.el


From: João Távora
Subject: master ffe12ff250: Clean up more robustly in compile.el
Date: Mon, 25 Jul 2022 09:18:03 -0400 (EDT)

branch: master
commit ffe12ff2503917e47c0356195b31430996c148f9
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Clean up more robustly in compile.el
    
    * lisp/progmodes/compile.el (compilation-sentinel): Use
    unwind-protect.
---
 lisp/progmodes/compile.el | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index c71a50d4fd..a665fccc73 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -2464,22 +2464,23 @@ commands of Compilation major mode are available.  See
 (defun compilation-sentinel (proc msg)
   "Sentinel for compilation buffers."
   (if (memq (process-status proc) '(exit signal))
-      (let ((buffer (process-buffer proc)))
-       (if (null (buffer-name buffer))
-           ;; buffer killed
-           (set-process-buffer proc nil)
-         (with-current-buffer buffer
-           ;; Write something in the compilation buffer
-           ;; and hack its mode line.
-           (compilation-handle-exit (process-status proc)
-                                    (process-exit-status proc)
-                                    msg)
-           ;; Since the buffer and mode line will show that the
-           ;; process is dead, we can delete it now.  Otherwise it
-           ;; will stay around until M-x list-processes.
-           (delete-process proc)))
+      (unwind-protect
+          (let ((buffer (process-buffer proc)))
+            (if (null (buffer-name buffer))
+                ;; buffer killed
+                (set-process-buffer proc nil)
+              (with-current-buffer buffer
+                ;; Write something in the compilation buffer
+                ;; and hack its mode line.
+                (compilation-handle-exit (process-status proc)
+                                         (process-exit-status proc)
+                                         msg))))
         (setq compilation-in-progress (delq proc compilation-in-progress))
-        (compilation--update-in-progress-mode-line))))
+        (compilation--update-in-progress-mode-line)
+        ;; Since the buffer and mode line will show that the
+        ;; process is dead, we can delete it now.  Otherwise it
+        ;; will stay around until M-x list-processes.
+        (delete-process proc))))
 
 (defun compilation-filter (proc string)
   "Process filter for compilation buffers.



reply via email to

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