summaryrefslogtreecommitdiff
path: root/lisp/progmodes/flymake.el
diff options
context:
space:
mode:
authorJoão Távora <joaotavora@gmail.com>2021-04-10 11:19:26 +0100
committerJoão Távora <joaotavora@gmail.com>2021-04-10 11:19:34 +0100
commitc50b5907e0113f7dbb2cc501c54dc365fd01a12b (patch)
tree3f401b208b81435afff2d98de301d18f26761ff0 /lisp/progmodes/flymake.el
parent0db2126d7176b0bd1b13d4b0d1cd958c8cf55714 (diff)
downloademacs-c50b5907e0113f7dbb2cc501c54dc365fd01a12b.tar.gz
Fail earlier if stale Flymake report functions called
If a Flymake backend calls a "stale" report function, flymake--handle-report might be called for a backend function that is no longer in the flymake--backend-state hash table. This patch makes that erroneous situation slightly more explicit. * lisp/progmodes/flymake.el (flymake--handle-report): Improve error reporting.
Diffstat (limited to 'lisp/progmodes/flymake.el')
-rw-r--r--lisp/progmodes/flymake.el5
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 8481a27775f..e10602ab081 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -741,7 +741,10 @@ to handle a report even if TOKEN was not expected. REGION is
a (BEG . END) pair of buffer positions indicating that this
report applies to that region."
(let* ((state (gethash backend flymake--backend-state))
- (first-report (not (flymake--backend-state-reported-p state))))
+ first-report)
+ (unless state
+ (error "Can't find state for %s in `flymake--backend-state'" backend))
+ (setf first-report (not (flymake--backend-state-reported-p state)))
(setf (flymake--backend-state-reported-p state) t)
(let (expected-token
new-diags)