From 2a2a1bdb8f0f149aaf736a61685feec9380be1b1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Fri, 29 Mar 2019 12:27:11 +0000 Subject: [PATCH] Protect Flymake from being corrupted by backends A backend building a diagnostic with a nil :type would cause Flymake to create a diagnostic without an overlay, confusing Flymake's accounting of overlays and diagnostics * lisp/progmodes/flymake.el (flymake--highlight-line): Return non-nil unconditionally. --- lisp/progmodes/flymake.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 83b5ee33aa0..6f3d2d59b5c 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -604,10 +604,11 @@ associated `flymake-category' return DEFAULT." (defun flymake--highlight-line (diagnostic) "Highlight buffer with info in DIGNOSTIC." - (when-let* ((type (flymake--diag-type diagnostic)) - (ov (make-overlay - (flymake--diag-beg diagnostic) - (flymake--diag-end diagnostic)))) + (let ((type (or (flymake--diag-type diagnostic) + :error)) + (ov (make-overlay + (flymake--diag-beg diagnostic) + (flymake--diag-end diagnostic)))) ;; First set `category' in the overlay ;; (overlay-put ov 'category -- 2.39.2