emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master c50b590: Fail earlier if stale Flymake report functions called


From: João Távora
Subject: master c50b590: Fail earlier if stale Flymake report functions called
Date: Sat, 10 Apr 2021 06:19:49 -0400 (EDT)

branch: master
commit c50b5907e0113f7dbb2cc501c54dc365fd01a12b
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    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.
---
 lisp/progmodes/flymake.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 8481a27..e10602a 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]