unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: john muhl <jm@pub.pink>
To: 70167@debbugs.gnu.org
Subject: bug#70167: [PATCH] Mark Flymake regions more accurately in lua-ts-mode
Date: Wed, 03 Apr 2024 12:59:24 -0500	[thread overview]
Message-ID: <878r1ub9q1.fsf@pub.pink> (raw)
In-Reply-To: <handler.70167.B.171216697516444.ack@debbugs.gnu.org>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0001-Mark-Flymake-regions-more-accurately-in-lua-ts-mode.patch --]
[-- Type: text/x-patch, Size: 4634 bytes --]

From a0c1f9c84a7072a807141f7b304a3c98c8e92173 Mon Sep 17 00:00:00 2001
From: john muhl <jm@pub.pink>
Date: Wed, 13 Mar 2024 08:35:08 -0500
Subject: [PATCH] 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 | 55 ++++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 27 deletions(-)

diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el
index 407ef230c32..a39cfa9e814 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,34 @@ lua-ts-flymake-luacheck
                            (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 (beg end msg type diags)
+                             (while
+                                 (search-forward-regexp
+                                  (rx (: bol (0+ alnum) ":"
+                                         (group (1+ digit)) ":"
+                                         (group (1+ digit)) "-"
+                                         (group (1+ digit)) ": "
+                                         (group (0+ nonl)) eol))
+                                  nil t)
+                               (setq beg
+                                     (car (flymake-diag-region
+                                           source
+                                           (string-to-number (match-string 1))
+                                           (string-to-number (match-string 2)))))
+                               (setq end
+                                     (cdr (flymake-diag-region
+                                           source
+                                           (string-to-number (match-string 1))
+                                           (string-to-number (match-string 3)))))
+                               (setq msg (match-string 4))
+                               (setq type (if (string-match "^(W" msg) :warning
+                                            :error))
+                               (when (and beg end)
+                                 (setq diags
+                                       (nconc diags
+                                              (list (flymake-make-diagnostic
+                                                     source beg end type msg))))))
+                             (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))
-- 
2.41.0






  parent reply	other threads:[~2024-04-03 17:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03 17:55 bug#70167: [PATCH] Mark Flymake regions more accurately in lua-ts-mode john muhl
     [not found] ` <handler.70167.B.171216697516444.ack@debbugs.gnu.org>
2024-04-03 17:59   ` john muhl [this message]
2024-04-04  6:05     ` Philip Kaludercic
2024-04-04  6:05     ` Philip Kaludercic
2024-04-04 16:45       ` john muhl
2024-04-10  8:28         ` Philip Kaludercic
2024-04-13  8:12         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878r1ub9q1.fsf@pub.pink \
    --to=jm@pub.pink \
    --cc=70167@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).