From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#70167: [PATCH] Mark Flymake regions more accurately in lua-ts-mode Date: Wed, 10 Apr 2024 08:28:08 +0000 Message-ID: <87h6g9mxk7.fsf@posteo.net> References: <87sf02baay.fsf@pub.pink> <878r1ub9q1.fsf@pub.pink> <87il0xek76.fsf@posteo.net> <875xwwq5o4.fsf@pub.pink> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19754"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70167@debbugs.gnu.org To: john muhl Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 10 10:29:18 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ruTKX-0004sh-RP for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Apr 2024 10:29:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruTKE-0007Vv-Ck; Wed, 10 Apr 2024 04:28:58 -0400 Original-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 ) id 1ruTKC-0007V7-5U for bug-gnu-emacs@gnu.org; Wed, 10 Apr 2024 04:28:56 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ruTKB-0006od-U0 for bug-gnu-emacs@gnu.org; Wed, 10 Apr 2024 04:28:55 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ruTKJ-0006n2-Up for bug-gnu-emacs@gnu.org; Wed, 10 Apr 2024 04:29:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 Apr 2024 08:29:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70167 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70167-submit@debbugs.gnu.org id=B70167.171273771025727 (code B ref 70167); Wed, 10 Apr 2024 08:29:03 +0000 Original-Received: (at 70167) by debbugs.gnu.org; 10 Apr 2024 08:28:30 +0000 Original-Received: from localhost ([127.0.0.1]:52086 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruTJl-0006gt-IT for submit@debbugs.gnu.org; Wed, 10 Apr 2024 04:28:30 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:36865) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruTJh-0006fv-5Z for 70167@debbugs.gnu.org; Wed, 10 Apr 2024 04:28:27 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 847F0240029 for <70167@debbugs.gnu.org>; Wed, 10 Apr 2024 10:28:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1712737690; bh=zSZZcN96jilq9MtWcWm5z320j2Dp7H2UoYT/mQr/gdc=; h=From:To:Cc:Subject:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:Content-Transfer-Encoding:From; b=GSpoadTzkJFARiwauRXi5/R3N2Y4FMameNu5Oe2L0z7DYorqZKaToDpoXFZ2KHhna +wcaHMwwPrO/zqtL4j2mlAFWH9sILGcebOXmJSk/MdOgTa6ZHQJn64IIrfmyMUZ4JI u6mBEdmhxtyF9xzqhRdH9tUJ+pqT0j+TJdE1EfAp1Pq3wDgkjMT87qxxVsHmGyYsbZ T4EYdUBJ1B43UFExgIDZdURrnlTq/Ut84w+0EsgTE48KTwLFmxynKriEzkQrTf8DLG d/NOUCvkw9q9a7zlTf7rNAMIDhk6d+BLzDeY9K9tkmaasNXLEIyxtohlVKk7+RAXv7 fIhz9GTv/gk1A== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4VDwvF4gxFz9rxN; Wed, 10 Apr 2024 10:28:09 +0200 (CEST) In-Reply-To: <875xwwq5o4.fsf@pub.pink> (john muhl's message of "Thu, 04 Apr 2024 11:45:05 -0500") OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:283031 Archived-At: john muhl writes: >>> + :error)) >>> + (when (and beg end) >>> + (setq diags >>> + (nconc diags >>> + (list (flymake-make-diag= nostic >>> + 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. > > Changed to use push. It doesn=E2=80=99t look like the order matters or did > I misunderstand something? It would make sense that it shouldn't matter (unless there is some subtle performance penalty in traversing the buffer in some order), so I think you can drop the nreverse. > Thanks for the review. > >>>From 910e88cf83415ae1e077fbc36560cb29fd39b666 Mon Sep 17 00:00:00 2001 > From: john muhl > 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 | 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) >=20=20 > (eval-when-compile > - (require 'cl-lib) > (require 'rx)) >=20=20 > (declare-function treesit-induce-sparse-tree "treesit.c") > @@ -544,32 +543,32 @@ 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) =3D (flymake-diag-region > - source > - (string-to-number (match-= string 1)) > - (string-to-number (match-= string 2))) > - for msg =3D (match-string 4) > - for type =3D (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-st= ring 1)) > + (string-to-number (match-st= ring 2))))) > + (end > + (cdr (flymake-diag-region > + source > + (string-to-number (match-st= ring 1)) > + (string-to-number (match-st= ring 3))))) > + (msg (match-string 4)) > + (type (if (string-prefix-p "(W" ms= g) > + :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-ma= x)) LGTM, but I am not really a Flymake expert. --=20 Philip Kaludercic on peregrine