]> git.eshelyaron.com Git - emacs.git/commitdiff
Clarify consequences of mismatching Flymake diagnostic buffers
authorJoão Távora <joaotavora@gmail.com>
Sat, 2 Nov 2019 15:53:45 +0000 (15:53 +0000)
committerJoão Távora <joaotavora@gmail.com>
Sat, 2 Nov 2019 15:56:19 +0000 (15:56 +0000)
Fix bug#34418.

* doc/misc/flymake.texi (Flymake utility functions): Add note to
flymake-make-diagnostic.

* lisp/progmodes/flymake.el (flymake--handle-report): Discard
diagnostics from other buffers.

doc/misc/flymake.texi
lisp/progmodes/flymake.el

index ebb89c32036ac8443fefc0e18dfc5aaa19b072bf..cedf1d84f90da1705d89bef8f1d9237200ac3157 100644 (file)
@@ -543,7 +543,9 @@ by calling the function @code{flymake-make-diagnostic}.
 Make a Flymake diagnostic for @var{buffer}'s region from @var{beg} to
 @var{end}.  @var{type} is a diagnostic symbol (@pxref{Flymake error
 types}), and @var{text} is a description of the problem detected in
-this region.
+this region.  Currently, it is unspecified behaviour to make
+diagnostics for buffers other than the buffer that the Flymake backend
+is responsible for.
 @end deffn
 
 @cindex access diagnostic object
index 6891e19fd1b3da0c2bf1e5ab2ac43e907d036e41..474c6335874c81131bd989e374bc5c73cc726e5d 100644 (file)
@@ -749,7 +749,10 @@ report applies to that region."
                                   (format "Unknown action %S" report-action))
         (flymake-error "Expected report, but got unknown key %s" report-action))
        (t
-        (setq new-diags report-action)
+        (setq new-diags
+              (cl-remove-if-not
+               (lambda (diag) (eq (flymake--diag-buffer diag) (current-buffer)))
+               report-action))
         (save-restriction
           (widen)
           ;; Before adding to backend's diagnostic list, decide if