master 7cf18b0d182: Flymake: use proper point-setting hygiene (bug#81621)

João Távora <[email protected]>
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: master
commit 7cf18b0d182342be768adfc6d532833bd786389c
Author: João Távora <[email protected]>
Commit: João Távora <[email protected]>

    Flymake: use proper point-setting hygiene (bug#81621)
    
    A report touches the eol overlays whose style could be influenced by
    current-ish position.  Saving point and going back to it, isn't 100%
    accurate (point may have moved between scheduling and multiple reports),
    but it is probably more than decent.  A marker would be better but
    requires at least a buffer-local var for proper cleanup, which is
    overkill IMO.
    
    * lisp/progmodes/flymake.el (flymake-make-report-fn): Use
    point-marker and save-excursion.
---
 lisp/progmodes/flymake.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 2d9ff648dce..49fd1421359 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -1261,8 +1261,11 @@ different runs of the same backend."
     (lambda (&rest args)
       (when (buffer-live-p buffer)
         (with-current-buffer buffer
-          (goto-char point)
-          (apply #'flymake--handle-report backend token args))))))
+          (save-excursion
+            ;; A report touches the eol overlays whose style could be
+            ;; influenced by current-ish position.
+            (goto-char point)
+            (apply #'flymake--handle-report backend token args)))))))
 
 (defun flymake--collect (fn &optional message-prefix)
   "Collect Flymake backends matching FN.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.