]> git.eshelyaron.com Git - emacs.git/commitdiff
Flymake: fix eol overlay flicker due to untimely overlay deletion
authorJoão Távora <joaotavora@gmail.com>
Thu, 21 Sep 2023 00:13:50 +0000 (01:13 +0100)
committerJoão Távora <joaotavora@gmail.com>
Thu, 21 Sep 2023 00:14:00 +0000 (01:14 +0100)
This commit helps in ensuring that `flymake--eol-overlay-update' is
only called once per cycle.

* lisp/progmodes/flymake.el (flymake--delete-overlay): Don't
delete eol overlay here.
(flymake--eol-overlay-summary): Rework again.
(flymake--eol-overlay-update): Delete eol overlay here.
(flymake-start): Make sure to set all backends reported-p to nil.

lisp/progmodes/flymake.el

index 80aa7e0a30e7b863d67c55e960b1d353e088a311..1b232050855e3bfdefb801b4a423015d91e3b1d0 100644 (file)
@@ -699,14 +699,13 @@ associated `flymake-category' return DEFAULT."
   (let ((eolov (overlay-get ov 'eol-ov)))
     (when eolov
       (let ((src-ovs (delq ov (overlay-get eolov 'flymake-eol-source-overlays))))
-        (if src-ovs (overlay-put eolov 'flymake-eol-source-overlays src-ovs)
-          (delete-overlay eolov))))
+        (overlay-put eolov 'flymake-eol-source-overlays src-ovs)))
     (delete-overlay ov)))
 
-(defun flymake--eol-overlay-summary (eolov)
-  "Helper function for `flymake--highlight-line'."
+(defun flymake--eol-overlay-summary (src-ovs)
+  "Helper function for `flymake--eol-overlay-update'."
   (cl-loop
-   for s in (overlay-get eolov 'flymake-eol-source-overlays)
+   for s in src-ovs
    for d = (overlay-get s 'flymake-diagnostic)
    for type = (flymake--diag-type d)
    for eol-face = (flymake--lookup-type-property type 'eol-face)
@@ -722,8 +721,10 @@ associated `flymake-category' return DEFAULT."
   (save-excursion
     (widen)
     (cl-loop for o in (overlays-in (point-min) (point-max))
-             when (overlay-get o 'flymake--eol-overlay)
-             do (overlay-put o 'before-string (flymake--eol-overlay-summary o)))))
+             for src-ovs = (overlay-get o 'flymake-eol-source-overlays)
+             if src-ovs
+             do (overlay-put o 'before-string (flymake--eol-overlay-summary src-ovs))
+             else do (delete-overlay o))))
 
 (cl-defun flymake--highlight-line (diagnostic &optional foreign)
   "Attempt to overlay DIAGNOSTIC in current buffer.
@@ -1187,6 +1188,11 @@ Interactively, with a prefix arg, FORCE is t."
                            (cl-reduce
                             #'max (mapcar #'cadr flymake--recent-changes))))))
                (setq flymake--recent-changes nil)
+               (run-hook-wrapped
+                'flymake-diagnostic-functions
+                (lambda (backend)
+                  (flymake--with-backend-state backend state
+                    (setf (flymake--state-reported-p state) nil))))
                (run-hook-wrapped
                 'flymake-diagnostic-functions
                 (lambda (backend)