emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master d5d61618c89: Mark Flymake regions more accurately in 'lua-ts-mode


From: Eli Zaretskii
Subject: master d5d61618c89: Mark Flymake regions more accurately in 'lua-ts-mode'
Date: Sat, 13 Apr 2024 04:11:50 -0400 (EDT)

branch: master
commit d5d61618c89899bd082cd29fd81dfb7cd88ea8b8
Author: john muhl <jm@pub.pink>
Commit: Eli Zaretskii <eliz@gnu.org>

    Mark Flymake regions more accurately in 'lua-ts-mode'
    
    * lisp/progmodes/lua-ts-mode.el (lua-ts-flymake-luacheck): Use
    the end position provided by Luacheck rather than relying on
    'thing-at-point' to guess where the end should be.  (Bug#70167)
---
 lisp/progmodes/lua-ts-mode.el | 53 +++++++++++++++++++++----------------------
 1 file changed, 26 insertions(+), 27 deletions(-)

diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el
index 407ef230c32..45ea8ec9a81 100644
--- a/lisp/progmodes/lua-ts-mode.el
+++ b/lisp/progmodes/lua-ts-mode.el
@@ -35,7 +35,6 @@
 (require 'treesit)
 
 (eval-when-compile
-  (require 'cl-lib)
   (require 'rx))
 
 (declare-function treesit-induce-sparse-tree "treesit.c")
@@ -544,32 +543,32 @@ Calls REPORT-FN directly."
                            (eq proc lua-ts--flymake-process))
                          (with-current-buffer (process-buffer proc)
                            (goto-char (point-min))
-                           (cl-loop
-                            while (search-forward-regexp
-                                   (rx (seq bol
-                                            (0+ alnum) ":"
-                                            (group (1+ digit)) ":"
-                                            (group (1+ digit)) "-"
-                                            (group (1+ digit)) ": "
-                                            (group (0+ nonl))
-                                            eol))
-                                   nil t)
-                            for (beg . end) = (flymake-diag-region
-                                               source
-                                               (string-to-number (match-string 
1))
-                                               (string-to-number (match-string 
2)))
-                            for msg = (match-string 4)
-                            for type = (if (string-match "^(W" msg)
-                                           :warning
-                                         :error)
-                            when (and beg end)
-                            collect (flymake-make-diagnostic source
-                                                             beg
-                                                             end
-                                                             type
-                                                             msg)
-                            into diags
-                            finally (funcall report-fn diags)))
+                           (let (diags)
+                             (while (search-forward-regexp
+                                     (rx bol (0+ alnum) ":"
+                                         (group (1+ digit)) ":"
+                                         (group (1+ digit)) "-"
+                                         (group (1+ digit)) ": "
+                                         (group (0+ nonl)) eol)
+                                     nil t)
+                               (let* ((beg
+                                       (car (flymake-diag-region
+                                             source
+                                             (string-to-number (match-string 
1))
+                                             (string-to-number (match-string 
2)))))
+                                      (end
+                                       (cdr (flymake-diag-region
+                                             source
+                                             (string-to-number (match-string 
1))
+                                             (string-to-number (match-string 
3)))))
+                                      (msg (match-string 4))
+                                      (type (if (string-prefix-p "(W" msg)
+                                                :warning
+                                              :error)))
+                                 (push (flymake-make-diagnostic
+                                        source beg end type msg)
+                                       diags)))
+                             (funcall report-fn diags)))
                        (flymake-log :warning "Canceling obsolete check %s" 
proc))
                    (kill-buffer (process-buffer proc)))))))
       (process-send-region lua-ts--flymake-process (point-min) (point-max))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]