aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Távora2023-09-21 01:13:50 +0100
committerJoão Távora2023-09-21 01:14:00 +0100
commitef8458558d5d3b95c88e71ec88feb7f950e44b7e (patch)
tree5ba9baf730012b4004a60661000cb415dfb1a68e
parentf35818f2e762d5aec5cdd62b3fe778060812a0b5 (diff)
downloademacs-ef8458558d5d3b95c88e71ec88feb7f950e44b7e.tar.gz
emacs-ef8458558d5d3b95c88e71ec88feb7f950e44b7e.zip
Flymake: fix eol overlay flicker due to untimely overlay deletion
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.
-rw-r--r--lisp/progmodes/flymake.el20
1 files changed, 13 insertions, 7 deletions
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 80aa7e0a30e..1b232050855 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -699,14 +699,13 @@ associated `flymake-category' return DEFAULT."
699 (let ((eolov (overlay-get ov 'eol-ov))) 699 (let ((eolov (overlay-get ov 'eol-ov)))
700 (when eolov 700 (when eolov
701 (let ((src-ovs (delq ov (overlay-get eolov 'flymake-eol-source-overlays)))) 701 (let ((src-ovs (delq ov (overlay-get eolov 'flymake-eol-source-overlays))))
702 (if src-ovs (overlay-put eolov 'flymake-eol-source-overlays src-ovs) 702 (overlay-put eolov 'flymake-eol-source-overlays src-ovs)))
703 (delete-overlay eolov))))
704 (delete-overlay ov))) 703 (delete-overlay ov)))
705 704
706(defun flymake--eol-overlay-summary (eolov) 705(defun flymake--eol-overlay-summary (src-ovs)
707 "Helper function for `flymake--highlight-line'." 706 "Helper function for `flymake--eol-overlay-update'."
708 (cl-loop 707 (cl-loop
709 for s in (overlay-get eolov 'flymake-eol-source-overlays) 708 for s in src-ovs
710 for d = (overlay-get s 'flymake-diagnostic) 709 for d = (overlay-get s 'flymake-diagnostic)
711 for type = (flymake--diag-type d) 710 for type = (flymake--diag-type d)
712 for eol-face = (flymake--lookup-type-property type 'eol-face) 711 for eol-face = (flymake--lookup-type-property type 'eol-face)
@@ -722,8 +721,10 @@ associated `flymake-category' return DEFAULT."
722 (save-excursion 721 (save-excursion
723 (widen) 722 (widen)
724 (cl-loop for o in (overlays-in (point-min) (point-max)) 723 (cl-loop for o in (overlays-in (point-min) (point-max))
725 when (overlay-get o 'flymake--eol-overlay) 724 for src-ovs = (overlay-get o 'flymake-eol-source-overlays)
726 do (overlay-put o 'before-string (flymake--eol-overlay-summary o))))) 725 if src-ovs
726 do (overlay-put o 'before-string (flymake--eol-overlay-summary src-ovs))
727 else do (delete-overlay o))))
727 728
728(cl-defun flymake--highlight-line (diagnostic &optional foreign) 729(cl-defun flymake--highlight-line (diagnostic &optional foreign)
729 "Attempt to overlay DIAGNOSTIC in current buffer. 730 "Attempt to overlay DIAGNOSTIC in current buffer.
@@ -1190,6 +1191,11 @@ Interactively, with a prefix arg, FORCE is t."
1190 (run-hook-wrapped 1191 (run-hook-wrapped
1191 'flymake-diagnostic-functions 1192 'flymake-diagnostic-functions
1192 (lambda (backend) 1193 (lambda (backend)
1194 (flymake--with-backend-state backend state
1195 (setf (flymake--state-reported-p state) nil))))
1196 (run-hook-wrapped
1197 'flymake-diagnostic-functions
1198 (lambda (backend)
1193 (cond 1199 (cond
1194 ((and (not force) 1200 ((and (not force)
1195 (flymake--with-backend-state backend state 1201 (flymake--with-backend-state backend state