diff options
| author | john muhl | 2024-03-13 08:35:08 -0500 |
|---|---|---|
| committer | Eli Zaretskii | 2024-04-13 11:11:18 +0300 |
| commit | d5d61618c89899bd082cd29fd81dfb7cd88ea8b8 (patch) | |
| tree | 490184383e7dbc958ba0e17850c18930ccb7908c | |
| parent | 71f8b2c3242b9b9455e9c6f25ad99ea900a1422f (diff) | |
| download | emacs-d5d61618c89899bd082cd29fd81dfb7cd88ea8b8.tar.gz emacs-d5d61618c89899bd082cd29fd81dfb7cd88ea8b8.zip | |
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)
| -rw-r--r-- | lisp/progmodes/lua-ts-mode.el | 53 |
1 files 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 @@ | |||
| 35 | (require 'treesit) | 35 | (require 'treesit) |
| 36 | 36 | ||
| 37 | (eval-when-compile | 37 | (eval-when-compile |
| 38 | (require 'cl-lib) | ||
| 39 | (require 'rx)) | 38 | (require 'rx)) |
| 40 | 39 | ||
| 41 | (declare-function treesit-induce-sparse-tree "treesit.c") | 40 | (declare-function treesit-induce-sparse-tree "treesit.c") |
| @@ -544,32 +543,32 @@ Calls REPORT-FN directly." | |||
| 544 | (eq proc lua-ts--flymake-process)) | 543 | (eq proc lua-ts--flymake-process)) |
| 545 | (with-current-buffer (process-buffer proc) | 544 | (with-current-buffer (process-buffer proc) |
| 546 | (goto-char (point-min)) | 545 | (goto-char (point-min)) |
| 547 | (cl-loop | 546 | (let (diags) |
| 548 | while (search-forward-regexp | 547 | (while (search-forward-regexp |
| 549 | (rx (seq bol | 548 | (rx bol (0+ alnum) ":" |
| 550 | (0+ alnum) ":" | 549 | (group (1+ digit)) ":" |
| 551 | (group (1+ digit)) ":" | 550 | (group (1+ digit)) "-" |
| 552 | (group (1+ digit)) "-" | 551 | (group (1+ digit)) ": " |
| 553 | (group (1+ digit)) ": " | 552 | (group (0+ nonl)) eol) |
| 554 | (group (0+ nonl)) | 553 | nil t) |
| 555 | eol)) | 554 | (let* ((beg |
| 556 | nil t) | 555 | (car (flymake-diag-region |
| 557 | for (beg . end) = (flymake-diag-region | 556 | source |
| 558 | source | 557 | (string-to-number (match-string 1)) |
| 559 | (string-to-number (match-string 1)) | 558 | (string-to-number (match-string 2))))) |
| 560 | (string-to-number (match-string 2))) | 559 | (end |
| 561 | for msg = (match-string 4) | 560 | (cdr (flymake-diag-region |
| 562 | for type = (if (string-match "^(W" msg) | 561 | source |
| 563 | :warning | 562 | (string-to-number (match-string 1)) |
| 564 | :error) | 563 | (string-to-number (match-string 3))))) |
| 565 | when (and beg end) | 564 | (msg (match-string 4)) |
| 566 | collect (flymake-make-diagnostic source | 565 | (type (if (string-prefix-p "(W" msg) |
| 567 | beg | 566 | :warning |
| 568 | end | 567 | :error))) |
| 569 | type | 568 | (push (flymake-make-diagnostic |
| 570 | msg) | 569 | source beg end type msg) |
| 571 | into diags | 570 | diags))) |
| 572 | finally (funcall report-fn diags))) | 571 | (funcall report-fn diags))) |
| 573 | (flymake-log :warning "Canceling obsolete check %s" proc)) | 572 | (flymake-log :warning "Canceling obsolete check %s" proc)) |
| 574 | (kill-buffer (process-buffer proc))))))) | 573 | (kill-buffer (process-buffer proc))))))) |
| 575 | (process-send-region lua-ts--flymake-process (point-min) (point-max)) | 574 | (process-send-region lua-ts--flymake-process (point-min) (point-max)) |