From: João Távora Date: Thu, 26 Oct 2023 13:20:41 +0000 (+0100) Subject: Flymake: protect against problematic invalid diagnostics X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=309823ff7796416414cee8c6f4d2650615c19f64;p=emacs.git Flymake: protect against problematic invalid diagnostics If a backend reports a diagnostic which is out of bounds, it still lives in flymake--state and will still be cleaned up in the next run of flymake--publish-diagnostics. But if flymake--highlight-line doesn't give it an overlay (which it didn't until now), things will break afterwards. See bug#66759 and https://github.com/joaotavora/eglot/discussions/1311 * lisp/progmodes/flymake.el (flymake--highlight-line): Set flymake--diag-overlay earlier. (Version): Bump to 1.3.7. --- diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index b27e6527f81..fb000517655 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -4,7 +4,7 @@ ;; Author: Pavel Kobyakov ;; Maintainer: João Távora -;; Version: 1.3.6 +;; Version: 1.3.7 ;; Keywords: c languages tools ;; Package-Requires: ((emacs "26.1") (eldoc "1.14.0") (project "0.7.1")) @@ -809,6 +809,7 @@ Return nil or the overlay created." (flymake--diag-orig-end e)) (flymake--delete-overlay eov))) (setq ov (make-overlay beg end)) + (setf (flymake--diag-overlay diagnostic) ov) (when (= (overlay-start ov) (overlay-end ov)) ;; Some backends report diagnostics with invalid bounds. Don't ;; bother. @@ -863,7 +864,6 @@ Return nil or the overlay created." (overlay-put ov 'evaporate t) (overlay-put ov 'flymake-overlay t) (overlay-put ov 'flymake-diagnostic diagnostic) - (setf (flymake--diag-overlay diagnostic) ov) ;; Handle `flymake-show-diagnostics-at-end-of-line' ;; (when flymake-show-diagnostics-at-end-of-line