GNU bug report logs - #70167
[PATCH] Mark Flymake regions more accurately in lua-ts-mode

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: john muhl <jm@HIDDEN>; Keywords: patch; dated Wed, 3 Apr 2024 17:57:04 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 70167 <at> debbugs.gnu.org:


Received: (at 70167) by debbugs.gnu.org; 4 Apr 2024 06:06:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 04 02:06:07 2024
Received: from localhost ([127.0.0.1]:60254 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rsGEg-0000o2-JS
	for submit <at> debbugs.gnu.org; Thu, 04 Apr 2024 02:06:07 -0400
Received: from mout01.posteo.de ([185.67.36.65]:52289)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1rsGEb-0000nC-Fe
 for 70167 <at> debbugs.gnu.org; Thu, 04 Apr 2024 02:06:05 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id C1C14240027
 for <70167 <at> debbugs.gnu.org>; Thu,  4 Apr 2024 08:05:50 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1712210750; bh=lbOCT8V7gmwhkIxCkictZFkATA9rK2cxP3diCHnUbYE=;
 h=From:To:Cc:Subject:OpenPGP:Date:Message-ID:MIME-Version:
 Content-Type:From;
 b=YTayhjn4AfHitmXku1b8fZ0k0glBcYqsnFNbCjV/GouomCvRRwW31etKFLzFApvEv
 DqOrmpkK/AMWsujPWgNHhzku/7n1qsdynBRxLkTSaYVQnCx71rAfoiAs0hPXBFz8HJ
 aFlgeTlWs3Zj9LIngAVMnhGUzS4o306V3jb+wm4oabM3GPJlOWrhqhDaXORN0c0/xC
 3p57UmGhY2Inkc1x6xLmmIoaI5AujYrdhSgMi2hZKQp8SWaJwPg1jXJJThbWmSY9sf
 xh7GvCvHwcKBJRq5sUv+17MYhstIeFdIGM/0E04sxjN7+LXj2E15HQB5wLhtnyclF5
 VvN96GWdBqMiQ==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4V9B1p29DLz6tx2;
 Thu,  4 Apr 2024 08:05:50 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: john muhl <jm@HIDDEN>
Subject: Re: bug#70167: [PATCH] Mark Flymake regions more accurately in
 lua-ts-mode
In-Reply-To: <878r1ub9q1.fsf@HIDDEN> (john muhl's message of "Wed, 03 Apr
 2024 12:59:24 -0500")
References: <87sf02baay.fsf@HIDDEN>
 <handler.70167.B.171216697516444.ack <at> debbugs.gnu.org>
 <878r1ub9q1.fsf@HIDDEN>
OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66;
 url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66";
 preference=signencrypt
Date: Thu, 04 Apr 2024 06:05:49 +0000
Message-ID: <87il0xek76.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70167
Cc: 70167 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

john muhl <jm@HIDDEN> writes:

>>From a0c1f9c84a7072a807141f7b304a3c98c8e92173 Mon Sep 17 00:00:00 2001
> From: john muhl <jm@HIDDEN>
> 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

Why do you declare these variables outside of the loop?  Should the
values persist between iterations?  If not, you could avoid the setq
soup below, by declaring and binding the variables at once.

> +                                 (search-forward-regexp
> +                                  (rx (: bol (0+ alnum) ":"
                                          ^
                                          this is not necessary, since
                                          the rx body has an implicit ":".

> +                                         (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
                                                  ^
                                                  You can avoid a
                                                  regular expression
                                                  here using `string-prefix-p'.

> +                                            :error))
> +                               (when (and beg end)
> +                                 (setq diags
> +                                       (nconc diags
> +                                              (list (flymake-make-diagnostic
> +                                                     source beg end type msg))))))
> +                             (funcall report-fn diags)))

If I see this correctly, then you are appending each element to the end
of the list?  If so, it would be more efficient to just construct the
list in reverse using `push' and then `nreverse'ing it before passing it
to REPORT-FN.

>                         (flymake-log :warning "Canceling obsolete check %s" proc))
>                     (kill-buffer (process-buffer proc)))))))
>        (process-send-region lua-ts--flymake-process (point-min) (point-max))

-- 
	Philip Kaludercic on peregrine




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70167; Package emacs. Full text available.

Message received at 70167 <at> debbugs.gnu.org:


Received: (at 70167) by debbugs.gnu.org; 4 Apr 2024 06:05:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 04 02:05:47 2024
Received: from localhost ([127.0.0.1]:60249 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rsGEM-0000mu-G1
	for submit <at> debbugs.gnu.org; Thu, 04 Apr 2024 02:05:47 -0400
Received: from mout02.posteo.de ([185.67.36.66]:37005)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1rsGEJ-0000lw-AI
 for 70167 <at> debbugs.gnu.org; Thu, 04 Apr 2024 02:05:45 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 7DEE5240101
 for <70167 <at> debbugs.gnu.org>; Thu,  4 Apr 2024 08:05:32 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1712210732; bh=lbOCT8V7gmwhkIxCkictZFkATA9rK2cxP3diCHnUbYE=;
 h=From:To:Cc:Subject:OpenPGP:Date:Message-ID:MIME-Version:
 Content-Type:From;
 b=JQrk3fQvnR6WS+kqgGdwnMIAKqsgQ8sNiqCnQI69bVc465QB5tn5p9q5m+ETSlyql
 DNoWNzHeknaH/e6db/czRWhP+udtOdlrJYl8TWeBWFCs7iguWqHo5GZhavg71Z2ey4
 xbcTuy6cnZCeNMO1hkyK/ofItwee+NorF/FQfD2xHnA3t0eaRM6Rk3gvVjccu+YnTK
 z2SivGYM/nYMHTsHcFB2OH+cm1TbmBnXa02O8nOrHcubQapdDJjPOVksdNbaU/MNNx
 GrlMacX3/lFZMCd0yFRKwDe4KzFv/Jh944eKkP/UdvAkKV3lVZ0YobpRh7ww4Sr4nu
 RAw5g5j1LRvKQ==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4V9B1F0ryDz6tyS;
 Thu,  4 Apr 2024 08:05:20 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: john muhl <jm@HIDDEN>
Subject: Re: bug#70167: [PATCH] Mark Flymake regions more accurately in
 lua-ts-mode
In-Reply-To: <878r1ub9q1.fsf@HIDDEN> (john muhl's message of "Wed, 03 Apr
 2024 12:59:24 -0500")
References: <87sf02baay.fsf@HIDDEN>
 <handler.70167.B.171216697516444.ack <at> debbugs.gnu.org>
 <878r1ub9q1.fsf@HIDDEN>
OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66;
 url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66";
 preference=signencrypt
Date: Thu, 04 Apr 2024 06:05:03 +0000
Message-ID: <87jzldek8g.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70167
Cc: 70167 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

john muhl <jm@HIDDEN> writes:

>>From a0c1f9c84a7072a807141f7b304a3c98c8e92173 Mon Sep 17 00:00:00 2001
> From: john muhl <jm@HIDDEN>
> 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

Why do you declare these variables outside of the loop?  Should the
values persist between iterations?  If not, you could avoid the setq
soup below, by declaring and binding the variables at once.

> +                                 (search-forward-regexp
> +                                  (rx (: bol (0+ alnum) ":"
                                          ^
                                          this is not necessary, since
                                          the rx body has an implicit ":".

> +                                         (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
                                                  ^
                                                  You can avoid a
                                                  regular expression
                                                  here using `string-prefix-p'.

> +                                            :error))
> +                               (when (and beg end)
> +                                 (setq diags
> +                                       (nconc diags
> +                                              (list (flymake-make-diagnostic
> +                                                     source beg end type msg))))))
> +                             (funcall report-fn diags)))

If I see this correctly, then you are appending each element to the end
of the list?  If so, it would be more efficient to just construct the
list in reverse using `push' and then `nreverse'ing it before passing it
to REPORT-FN.

>                         (flymake-log :warning "Canceling obsolete check %s" proc))
>                     (kill-buffer (process-buffer proc)))))))
>        (process-send-region lua-ts--flymake-process (point-min) (point-max))

-- 
	Philip Kaludercic on peregrine




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70167; Package emacs. Full text available.

Message received at 70167 <at> debbugs.gnu.org:


Received: (at 70167) by debbugs.gnu.org; 3 Apr 2024 18:08:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 03 14:08:24 2024
Received: from localhost ([127.0.0.1]:59530 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rs527-0005KG-P9
	for submit <at> debbugs.gnu.org; Wed, 03 Apr 2024 14:08:24 -0400
Received: from wnew1-smtp.messagingengine.com ([64.147.123.26]:49601)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jm@HIDDEN>) id 1rs523-0005K0-HM
 for 70167 <at> debbugs.gnu.org; Wed, 03 Apr 2024 14:08:21 -0400
Received: from compute4.internal (compute4.nyi.internal [10.202.2.44])
 by mailnew.west.internal (Postfix) with ESMTP id 250A92B0024C
 for <70167 <at> debbugs.gnu.org>; Wed,  3 Apr 2024 14:08:08 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute4.internal (MEProxy); Wed, 03 Apr 2024 14:08:08 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pub.pink; h=cc
 :content-type:content-type:date:date:from:from:in-reply-to
 :in-reply-to:message-id:mime-version:references:reply-to:subject
 :subject:to:to; s=fm2; t=1712167687; x=1712174887; bh=zq5/mlneVS
 I2hqKoP7MmpXakrU0CfRtHaAt6/roPn40=; b=uv6V/X24G09SBeVa8RW2HNB7mb
 xPIUfnpjmriCYv2gnaWWLln1M1Qa8JX1LIstlPNakJB0bim8AFD+DWpyBShEKZea
 a4q+wrQyEVZRCaUVHJ0THNkQIykeYd0YAIv3gVM5rfCsyTFd+AmWxtJlLnYC1i+k
 kwwIPqKfZN+qTjVhdpcpfQ17jrDwoy4KbZnIbM2Lg/s8kSgX/W3IwaMjsN77mzkG
 DEj8w1MUz0E2SMCuxFOdFR2lHOiJV9c1yQ5twF0oiEEyVvsO1+pL/sa3AQJhBk4f
 Bqe9MfArOv3BhoXfPPhNtySiRxPuqCOGaDdO+LAsuqdT8V5NMgxdrinUtv8g==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-type:content-type:date:date
 :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to
 :message-id:mime-version:references:reply-to:subject:subject:to
 :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=
 fm2; t=1712167687; x=1712174887; bh=zq5/mlneVSI2hqKoP7MmpXakrU0C
 fRtHaAt6/roPn40=; b=Lb8IcpAzgt6kQyrqIPlOI5Y1aJaufGzJfxrLo0SdIuUh
 F2bo+nBUEc+V/ekeY4snVYQ3bmhMHiKzkEcUNC5sBIM+CZuoSoiQGVYuQnIRqVNw
 eVkbc1H2KRjhJ/kIFuqeFh3qY+1psvkwjSoWYdIUMGL2c4R66dfy3i5z/IGkOLZ/
 xw0vefLOSpRX/s/6uEDBaG2DsIl7n6pCVoK+vGcU5sruNTJdTc6BFsiSCTLU7TZN
 /Z4w7L+bAwCDAa5oNVsq8vsrKcviSPhvKPMsy02WwYwrMMfObWB5gCQnDw1vui+X
 MAkALtziXPyzklXjbhZ5eyy/8GIJIwBWDU4Wtq94FQ==
X-ME-Sender: <xms:B5sNZi_Cm2DK1g5XIsM-txJo3XLNVe3NdM7olDNCYRIbfqtQypOTiA>
 <xme:B5sNZisEEiAF5ECWdE_ytJIHR4uyGwMmwEa4NjOHqqY3Q27BK0sJdsxfO43WlB-vH
 eF-PYa7xm-d2CLsjiU>
X-ME-Received: <xmr:B5sNZoDAbvDrh9036Fn4zgh1cYO82ZS3fEIUb6rF39sfEN3g7jEMjaa0uAFp3wKqYcvcdOuvqm1ysFrySufHl4KpVA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudefiedgjeejucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucgovehorghsthgrlhdqffegtdefqddtheculdeftd
 dtmdenucfjughrpehffgfhvffuffgjkfggtgguseertdertddtredtnecuhfhrohhmpehj
 ohhhnhcumhhuhhhluceojhhmsehpuhgsrdhpihhnkheqnecuggftrfgrthhtvghrnhepge
 ehiedvgeekhedugedtveefffeihedtgeehfeetieejvdeffefgffehffehheejnecuvehl
 uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhhmsehpuhgsrd
 hpihhnkh
X-ME-Proxy: <xmx:B5sNZqdi_ppPDGiwb2OaISLjavtX5xUNvscPbeVtBNr0wXY24_Nmag>
 <xmx:B5sNZnPPKYuyKObEcq823XpaD6X-jC4xWk93H76r6rIhmx5ug5hdqQ>
 <xmx:B5sNZklCGUrfw-OhqMIpIO7YnHKgBm4Op0fbiOUjEDFbn7lR70YOww>
 <xmx:B5sNZptgOBq94fQ9Lo6vE9QXzOE1pGhaH2EYjOKFZBpW94NtlqHNpQ>
 <xmx:B5sNZtajyv97ZmnrHStATKsnUB-Oga4LMyqFx9ZRkmadsrctmig91kCBX_Oy>
Feedback-ID: i74194916:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA for
 <70167 <at> debbugs.gnu.org>; Wed, 3 Apr 2024 14:08:07 -0400 (EDT)
References: <87sf02baay.fsf@HIDDEN>
 <handler.70167.B.171216697516444.ack <at> debbugs.gnu.org>
User-agent: mu4e 1.10.8; emacs 30.0.50
From: john muhl <jm@HIDDEN>
To: 70167 <at> debbugs.gnu.org
Subject: Re: bug#70167: [PATCH] Mark Flymake regions more accurately in
 lua-ts-mode
Date: Wed, 03 Apr 2024 12:59:24 -0500
In-reply-to: <handler.70167.B.171216697516444.ack <at> debbugs.gnu.org>
Message-ID: <878r1ub9q1.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Mark-Flymake-regions-more-accurately-in-lua-ts-mode.patch
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 70167
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

From a0c1f9c84a7072a807141f7b304a3c98c8e92173 Mon Sep 17 00:00:00 2001
From: john muhl <jm@HIDDEN>
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





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70167; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 3 Apr 2024 17:56:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 03 13:56:15 2024
Received: from localhost ([127.0.0.1]:59519 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rs4qN-0004H9-8C
	for submit <at> debbugs.gnu.org; Wed, 03 Apr 2024 13:56:15 -0400
Received: from lists.gnu.org ([2001:470:142::17]:52214)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jm@HIDDEN>) id 1rs4qH-0004FI-Qb
 for submit <at> debbugs.gnu.org; Wed, 03 Apr 2024 13:56:13 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <jm@HIDDEN>) id 1rs4q0-0005Qu-FK
 for bug-gnu-emacs@HIDDEN; Wed, 03 Apr 2024 13:55:52 -0400
Received: from wout3-smtp.messagingengine.com ([64.147.123.19])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <jm@HIDDEN>) id 1rs4pr-0001lx-P6
 for bug-gnu-emacs@HIDDEN; Wed, 03 Apr 2024 13:55:45 -0400
Received: from compute7.internal (compute7.nyi.internal [10.202.2.48])
 by mailout.west.internal (Postfix) with ESMTP id C2E953200A7A
 for <bug-gnu-emacs@HIDDEN>; Wed,  3 Apr 2024 13:55:36 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute7.internal (MEProxy); Wed, 03 Apr 2024 13:55:36 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pub.pink; h=cc
 :content-transfer-encoding:content-type:content-type:date:date
 :from:from:in-reply-to:message-id:mime-version:reply-to:subject
 :subject:to:to; s=fm2; t=1712166936; x=1712253336; bh=3U6WDulx9D
 0vmhHTxFQ/IxX9F1hoa7npQgQFGiaYJ4Y=; b=3BZJB69ZGW/89XP3sGTC4fbWH+
 pkFbBtzR6ERIvGSxlEf68x1oevdsMjmKYq6InaxAPBbU9NUP7bDJP1jnwIbOPbWF
 KJ5nQyztu2DDBArs1M7sPfaSWmRMUlDAz8scxyrlryFrdskLUosbtJQgu+Bh4TZr
 0zhC5WKwYWvJsdGXy2sM9Afz7DNX8OTM6vFlgby5fR+YfriZa0h73c90LmztNFcb
 dqU24UbklhtlasOZhEExTfnp2wQXkLjSCwjDGG4KMeRzsugcd0uun9PugtW0Qlvn
 kQ+vLQM+oGuBs3tD11RvSDbhrrk+HBVRZ5/Ck4Q2vMbh0eZfVPYqO/mVv8iw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :content-type:date:date:feedback-id:feedback-id:from:from
 :in-reply-to:message-id:mime-version:reply-to:subject:subject:to
 :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=
 fm2; t=1712166936; x=1712253336; bh=3U6WDulx9D0vmhHTxFQ/IxX9F1ho
 a7npQgQFGiaYJ4Y=; b=PbZw6zgY3NKwCFyLM+rbJXziYb14+qWfVuTPPEN4OAoP
 U0J0OAxWKtBvgrnoiNja6ddGH5Ml+iyj6Qe890YdMHZcB0Shz89GILqVfagZ9bby
 lwqDfZ7d3X6XCgbaj444P58bcSlIbN8QgwbmDZs5Lsk5302ah2MYq0FmNXmlYyOx
 wdonbAqo5yA4xMJcpoXnn3zgyGSa+JuzmXSSwRrDI3pVJ0t1APcF0+8irRXfoqkM
 B0VS63qgiUWLCV0CoFvhjIWMuNE3k9dKq8w/HzLn2klsCoEUiZRxUhwbxoca8lnM
 omgsyoqBUtrOKx6eM66184kEZRSqOXqbgzRUUrugwQ==
X-ME-Sender: <xms:GJgNZiuz_QACc9ywZSlif97Ka7BlFXFdYZXOrwRj0BQXiHJtUvaCXA>
 <xme:GJgNZncHmBhZ9luxbZBgitI6e1oduqptU26CLvcGpGchd_mz9e76yiHnsT1AohKmZ
 kFZo6ifC2vK5crmOSY>
X-ME-Received: <xmr:GJgNZtxvhBr3hHCmAHCdd0SdjWslMqaV1EZxTgmGnUJ0yXeyVKMNvPJaIOJSSpOjv2Cqx8miI5AUx-19S7Z25c8A3w>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudefiedgjeehucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkgggtgfesthhqredttd
 dtjeenucfhrhhomhepjhhohhhnuchmuhhhlhcuoehjmhesphhusgdrphhinhhkqeenucgg
 tffrrghtthgvrhhnpeetuefhgfeuieejteekffejudettdeuueekueffkeeileekueegle
 efkefhgefhueenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhr
 ohhmpehjmhesphhusgdrphhinhhk
X-ME-Proxy: <xmx:GJgNZtO0lnLgBRFER5nlrcb5DGnLZke9el5yLIye2jmwQJM7KJSW4Q>
 <xmx:GJgNZi9UaBl0thqKlRNCpk4svdJWMMou9Yp8XJskWdX7V7uHdIIVvA>
 <xmx:GJgNZlWuSGtZ56ggNWxyy_FVDMxBwAd7DMNgg7_5SC0gqYCy2K2XuQ>
 <xmx:GJgNZrcpjNlbecvo690Ffm7t-JJjX9WDLHAC61OvBmeJs_CFg4_TKg>
 <xmx:GJgNZolnkqrQ3DNRUgxAWPZXDtB6uv-l3-r-6CMDKu9UlZ1xqqIoCZ-7Su9F>
Feedback-ID: i74194916:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA for
 <bug-gnu-emacs@HIDDEN>; Wed, 3 Apr 2024 13:55:35 -0400 (EDT)
From: john muhl <jm@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Mark Flymake regions more accurately in lua-ts-mode
Date: Wed, 03 Apr 2024 12:55:33 -0500
Message-ID: <87sf02baay.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=64.147.123.19; envelope-from=jm@HIDDEN;
 helo=wout3-smtp.messagingengine.com
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)

Tags: patch

This changes the diagnostic region end position from being guessed
based on thing-at-point to using the one provided by LuaCheck. As
noted in bug#67152 it was already being matched but not used. I
couldn=E2=80=99t find anything where t-a-p guessed wrong but it seems
preferable to just mark exactly the same region as LuaCheck would.




Acknowledgement sent to john muhl <jm@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#70167; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 4 Apr 2024 06:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.