From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: john muhl Newsgroups: gmane.emacs.bugs Subject: bug#70167: [PATCH] Mark Flymake regions more accurately in lua-ts-mode Date: Wed, 03 Apr 2024 12:59:24 -0500 Message-ID: <878r1ub9q1.fsf@pub.pink> References: <87sf02baay.fsf@pub.pink> Mime-Version: 1.0 Content-Type: text/x-patch Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29428"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.10.8; emacs 30.0.50 To: 70167@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 03 20:09:32 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 1rs53B-0007LJ-3r for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 03 Apr 2024 20:09:30 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rs52l-0007Rm-O7; Wed, 03 Apr 2024 14:09:04 -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 1rs52h-0007R4-3j for bug-gnu-emacs@gnu.org; Wed, 03 Apr 2024 14:08:59 -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 1rs52g-0000wu-Cs for bug-gnu-emacs@gnu.org; Wed, 03 Apr 2024 14:08:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rs52k-0005MM-Do for bug-gnu-emacs@gnu.org; Wed, 03 Apr 2024 14:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: john muhl Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 03 Apr 2024 18:09:02 +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.171216770420480 (code B ref 70167); Wed, 03 Apr 2024 18:09:02 +0000 Original-Received: (at 70167) by debbugs.gnu.org; 3 Apr 2024 18:08:24 +0000 Original-Received: from localhost ([127.0.0.1]:59530 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rs527-0005KG-P9 for submit@debbugs.gnu.org; Wed, 03 Apr 2024 14:08:24 -0400 Original-Received: from wnew1-smtp.messagingengine.com ([64.147.123.26]:49601) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rs523-0005K0-HM for 70167@debbugs.gnu.org; Wed, 03 Apr 2024 14:08:21 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id 250A92B0024C for <70167@debbugs.gnu.org>; Wed, 3 Apr 2024 14:08:08 -0400 (EDT) Original-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: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudefiedgjeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgovehorghsthgrlhdqffegtdefqddtheculdeftd dtmdenucfjughrpehffgfhvffuffgjkfggtgguseertdertddtredtnecuhfhrohhmpehj ohhhnhcumhhuhhhluceojhhmsehpuhgsrdhpihhnkheqnecuggftrfgrthhtvghrnhepge ehiedvgeekhedugedtveefffeihedtgeehfeetieejvdeffefgffehffehheejnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhhmsehpuhgsrd hpihhnkh X-ME-Proxy: Feedback-ID: i74194916:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA for <70167@debbugs.gnu.org>; Wed, 3 Apr 2024 14:08:07 -0400 (EDT) In-reply-to: Content-Disposition: attachment; filename=0001-Mark-Flymake-regions-more-accurately-in-lua-ts-mode.patch 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:282585 Archived-At: >From a0c1f9c84a7072a807141f7b304a3c98c8e92173 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 | 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