aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Távora2019-11-02 15:53:45 +0000
committerJoão Távora2019-11-02 15:56:19 +0000
commitb32c4d7bac8e0b3642d8ad90ee40a44466e29aad (patch)
treee359ac2fbc7cc9ad2f7a237c7b79f7a02a91e1a8
parent3937c9f6e23b92ed5d7e6d42b8bf00101628af00 (diff)
downloademacs-b32c4d7bac8e0b3642d8ad90ee40a44466e29aad.tar.gz
emacs-b32c4d7bac8e0b3642d8ad90ee40a44466e29aad.zip
Clarify consequences of mismatching Flymake diagnostic buffers
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.
-rw-r--r--doc/misc/flymake.texi4
-rw-r--r--lisp/progmodes/flymake.el5
2 files changed, 7 insertions, 2 deletions
diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi
index ebb89c32036..cedf1d84f90 100644
--- a/doc/misc/flymake.texi
+++ b/doc/misc/flymake.texi
@@ -543,7 +543,9 @@ by calling the function @code{flymake-make-diagnostic}.
543Make a Flymake diagnostic for @var{buffer}'s region from @var{beg} to 543Make a Flymake diagnostic for @var{buffer}'s region from @var{beg} to
544@var{end}. @var{type} is a diagnostic symbol (@pxref{Flymake error 544@var{end}. @var{type} is a diagnostic symbol (@pxref{Flymake error
545types}), and @var{text} is a description of the problem detected in 545types}), and @var{text} is a description of the problem detected in
546this region. 546this region. Currently, it is unspecified behaviour to make
547diagnostics for buffers other than the buffer that the Flymake backend
548is responsible for.
547@end deffn 549@end deffn
548 550
549@cindex access diagnostic object 551@cindex access diagnostic object
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 6891e19fd1b..474c6335874 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -749,7 +749,10 @@ report applies to that region."
749 (format "Unknown action %S" report-action)) 749 (format "Unknown action %S" report-action))
750 (flymake-error "Expected report, but got unknown key %s" report-action)) 750 (flymake-error "Expected report, but got unknown key %s" report-action))
751 (t 751 (t
752 (setq new-diags report-action) 752 (setq new-diags
753 (cl-remove-if-not
754 (lambda (diag) (eq (flymake--diag-buffer diag) (current-buffer)))
755 report-action))
753 (save-restriction 756 (save-restriction
754 (widen) 757 (widen)
755 ;; Before adding to backend's diagnostic list, decide if 758 ;; Before adding to backend's diagnostic list, decide if