]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/flymake.el (flymake-start): Fix dead buffer case
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 3 Nov 2017 12:33:13 +0000 (08:33 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Fri, 3 Nov 2017 12:33:13 +0000 (08:33 -0400)
Don't try to flymake-start within a buffer that doesn't exist any more.

lisp/progmodes/flymake.el

index 1048bc5065559991c64453cb238ff41d4752c063..c2349d8c7cc05593c7c9831f6e66a9c67999e2eb 100644 (file)
@@ -601,8 +601,8 @@ not expected."
           (null expected-token))
         ;; should never happen
         (flymake-error "Unexpected report from stopped backend %s" backend))
-       ((and (not (eq expected-token token))
-             (not force))
+       ((not (or (eq expected-token token)
+                 force))
         (flymake-error "Obsolete report from backend %s with explanation %s"
                        backend explanation))
        ((eq :panic report-action)
@@ -742,8 +742,11 @@ Interactively, with a prefix arg, FORCE is t."
           ()
           (remove-hook 'post-command-hook #'start-post-command
                        nil)
-          (with-current-buffer buffer
-            (flymake-start (remove 'post-command deferred) force)))
+          ;; The buffer may have disappeared already, e.g. because of
+          ;; code like `(with-temp-buffer (python-mode) ...)'.
+          (when (buffer-live-p buffer)
+            (with-current-buffer buffer
+              (flymake-start (remove 'post-command deferred) force))))
          (start-on-display
           ()
           (remove-hook 'window-configuration-change-hook #'start-on-display