]> git.eshelyaron.com Git - emacs.git/commitdiff
More carefully cleanup Flymake C/C++ backend's temp buffers
authorJoão Távora <joaotavora@gmail.com>
Thu, 28 Mar 2019 18:04:35 +0000 (18:04 +0000)
committerJoão Távora <joaotavora@gmail.com>
Tue, 2 Jul 2019 15:09:59 +0000 (16:09 +0100)
Sometimes the Flymake process dies by some means that doesn't involve
a sentinel call for the "exit" status, so we clean up the temporary
buffer as soon as we notice it's not process-alive-p anymore.

* lisp/progmodes/flymake-cc.el (flymake-cc): Broaden cleanup
conditions.

lisp/progmodes/flymake-cc.el

index 5733ef4d66627850b51a064078749ac55be3dcdd..ecf6e648a7e8da4b91d24a1ae2b03dbb013a80d0 100644 (file)
@@ -120,8 +120,8 @@ REPORT-FN is Flymake's callback."
         :noquery t :connection-type 'pipe
         :sentinel
         (lambda (p _ev)
-          (when (eq 'exit (process-status p))
-            (unwind-protect
+          (unwind-protect
+              (when (eq 'exit (process-status p))
                 (when (with-current-buffer source (eq p flymake-cc--proc))
                   (with-current-buffer (process-buffer p)
                     (goto-char (point-min))
@@ -135,7 +135,8 @@ REPORT-FN is Flymake's callback."
                                  :panic :explanation
                                  (buffer-substring
                                   (point-min) (progn (goto-char (point-min))
-                                                     (line-end-position))))))))
+                                                     (line-end-position)))))))))
+            (unless (process-live-p p)
               ;; (display-buffer (process-buffer p)) ; uncomment to debug
               (kill-buffer (process-buffer p)))))))
       (process-send-region flymake-cc--proc (point-min) (point-max))