emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 459869a: Properly remove stale Flymake diagnostics


From: João Távora
Subject: [Emacs-diffs] master 459869a: Properly remove stale Flymake diagnostics on :region reports
Date: Sun, 10 Feb 2019 16:40:07 -0500 (EST)

branch: master
commit 459869a528ff02787255391ab90f68195c27b807
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    Properly remove stale Flymake diagnostics on :region reports
    
    Among other bugs fixed, modifying a list structure while iterating it
    is a no-no.  This would again cause duplicate diagnostics.  See
    https://github.com/joaotavora/eglot/issues/223 for an example.
    
    * lisp/progmodes/flymake.el (Version): Bump to 1.0.5
    (flymake--handle-report): Use cl-loop.
---
 lisp/progmodes/flymake.el | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 15a4d25..d991cca 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -4,7 +4,7 @@
 
 ;; Author:  Pavel Kobyakov <address@hidden>
 ;; Maintainer: João Távora <address@hidden>
-;; Version: 1.0.4
+;; Version: 1.0.5
 ;; Package-Requires: ((emacs "26.1"))
 ;; Keywords: c languages tools
 
@@ -742,14 +742,13 @@ report applies to that region."
           ;; the associated overlay.
           (cond
            (region
-            (dolist (diag (flymake--backend-state-diags state))
-              (let ((diag-beg (flymake--diag-beg diag))
-                    (diag-end (flymake--diag-beg diag)))
-                (when (and (< diag-beg (cdr region))
-                           (> diag-end (car region)))
-                  (delete-overlay (flymake--diag-overlay diag))
-                  (setf (flymake--backend-state-diags state)
-                        (delq diag (flymake--backend-state-diags state)))))))
+            (cl-loop for diag in (flymake--backend-state-diags state)
+                     if (or (> (flymake--diag-end diag) (car region))
+                            (< (flymake--diag-beg diag) (cdr region)))
+                     do (delete-overlay (flymake--diag-overlay diag))
+                     else collect diag into surviving
+                     finally (setf (flymake--backend-state-diags state)
+                                   surviving)))
            (first-report
             (dolist (diag (flymake--backend-state-diags state))
               (delete-overlay (flymake--diag-overlay diag)))



reply via email to

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