diff options
| author | João Távora | 2019-02-10 21:38:46 +0000 |
|---|---|---|
| committer | João Távora | 2019-02-10 21:38:46 +0000 |
| commit | 459869a528ff02787255391ab90f68195c27b807 (patch) | |
| tree | 8efd7141fb2533f8fe5e10155c5683a693c338df | |
| parent | 24695e8977c3d048e60d1fe3714b789567c2213c (diff) | |
| download | emacs-459869a528ff02787255391ab90f68195c27b807.tar.gz emacs-459869a528ff02787255391ab90f68195c27b807.zip | |
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.
| -rw-r--r-- | lisp/progmodes/flymake.el | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 15a4d259859..d991ccafc98 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | ;; Author: Pavel Kobyakov <pk_at_work@yahoo.com> | 5 | ;; Author: Pavel Kobyakov <pk_at_work@yahoo.com> |
| 6 | ;; Maintainer: João Távora <joaotavora@gmail.com> | 6 | ;; Maintainer: João Távora <joaotavora@gmail.com> |
| 7 | ;; Version: 1.0.4 | 7 | ;; Version: 1.0.5 |
| 8 | ;; Package-Requires: ((emacs "26.1")) | 8 | ;; Package-Requires: ((emacs "26.1")) |
| 9 | ;; Keywords: c languages tools | 9 | ;; Keywords: c languages tools |
| 10 | 10 | ||
| @@ -742,14 +742,13 @@ report applies to that region." | |||
| 742 | ;; the associated overlay. | 742 | ;; the associated overlay. |
| 743 | (cond | 743 | (cond |
| 744 | (region | 744 | (region |
| 745 | (dolist (diag (flymake--backend-state-diags state)) | 745 | (cl-loop for diag in (flymake--backend-state-diags state) |
| 746 | (let ((diag-beg (flymake--diag-beg diag)) | 746 | if (or (> (flymake--diag-end diag) (car region)) |
| 747 | (diag-end (flymake--diag-beg diag))) | 747 | (< (flymake--diag-beg diag) (cdr region))) |
| 748 | (when (and (< diag-beg (cdr region)) | 748 | do (delete-overlay (flymake--diag-overlay diag)) |
| 749 | (> diag-end (car region))) | 749 | else collect diag into surviving |
| 750 | (delete-overlay (flymake--diag-overlay diag)) | 750 | finally (setf (flymake--backend-state-diags state) |
| 751 | (setf (flymake--backend-state-diags state) | 751 | surviving))) |
| 752 | (delq diag (flymake--backend-state-diags state))))))) | ||
| 753 | (first-report | 752 | (first-report |
| 754 | (dolist (diag (flymake--backend-state-diags state)) | 753 | (dolist (diag (flymake--backend-state-diags state)) |
| 755 | (delete-overlay (flymake--diag-overlay diag))) | 754 | (delete-overlay (flymake--diag-overlay diag))) |