bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#60830: 30.0.50; The *Compilation* buffer does not recognize Lua erro


From: Stefan Kangas
Subject: bug#60830: 30.0.50; The *Compilation* buffer does not recognize Lua errors
Date: Tue, 3 Oct 2023 02:37:36 -0700

Rudolf Adamkovič <salutis@me.com> writes:

> As for (2), I recompiled Emacs from 'master' (498d31e9f05) to verify
> your claim, but it does seem to hold.  I can reproduce the bug under
> 'emacs -Q' by following the reproduction steps.
>
> However!  I did some thinking and realized two important facts:
>
> (A) Even if the GNU standard supported tab-indented errors, as per (2),
> it would not help, as Lua stack frames are not errors.

Yes, I noticed that too.  Is it a regression with regards to earlier
versions of Emacs?

> (B) People use older Lua versions, which will work forever, as they are
> written in ANSI C, and so even if (1) is fixed upstream, we must support
> the current error format as well.

I see the benefit of doing that, but I wouldn't say it so strongly that
we "must" do it.  We could also just say that people that want these
errors detected should upgrade lua.  Note that people would also need to
upgrade Emacs, to get this support.

> After I realized that (A) and (B) are true, I used my morning to write a
> patch that solves the problem properly.  I am attaching the patch to
> this message.  Do you think the patch could be merged upstream?

Mattias, what do you think of the below patch?

> Thank you for your time!

Thanks for working on this.

> From 3bbf4019df45548d1286ba9b0dffe8fadad2bdf1 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <salutis@me.com>
> Date: Tue, 3 Oct 2023 09:07:40 +0200
> Subject: [PATCH] Make the Compilation mode recognize Lua errors
>
> Emacs comes with built-in support for the Lua programming language in
> the form of the Lua mode and now also the Lua Tree-sitter mode.  But,
> Lua support in Emacs is incomplete in that the Compilation mode does
> not recognize Lua errors, which is what this patch fixes.
>
> Reported as bug#60830.
>
> * lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
> Add regexps to aid Lua development, namely the 'lua' regexp that
> matches Lua errors and the 'lua-stack' regexp that matches Lua stack
> frames.
>
> * test/lisp/progmodes/compile-tests.el (compile-tests--test-regexps-data):
> (compile-test-error-regexps): Test the new 'lua' and 'lua-stack'
> regexps added to the 'compilation-error-regexp-alist-alist'.
> ---
>  lisp/progmodes/compile.el            |  5 +++++
>  test/lisp/progmodes/compile-tests.el | 13 +++++++++++--
>  2 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
> index f85cc0909dd..82f8280d76d 100644
> --- a/lisp/progmodes/compile.el
> +++ b/lisp/progmodes/compile.el
> @@ -362,6 +362,11 @@ compilation-error-regexp-alist-alist
>      (ruby-Test::Unit
>       "^    [[ ]?\\([^ (].*\\):\\([1-9][0-9]*\\)\\(\\]\\)?:in " 1 2)
>
> +    (lua
> +     "^[^: \n\t]+: \\([^: \n\t]+\\):\\([0-9]+\\): " 1 2 nil 2 1)
> +    (lua-stack
> +     "^\t\\([^: \n\t]+\\):\\([0-9]+\\): " 1 2 nil 0 1)
> +
>      (gmake
>       ;; Set GNU make error messages as INFO level.
>       ;; It starts with the name of the make program which is variable,
> diff --git a/test/lisp/progmodes/compile-tests.el 
> b/test/lisp/progmodes/compile-tests.el
> index 078eef36774..889b3443993 100644
> --- a/test/lisp/progmodes/compile-tests.el
> +++ b/test/lisp/progmodes/compile-tests.el
> @@ -208,6 +208,15 @@ compile-tests--test-regexps-data
>       1 0 31 "/usr/include/c++/3.3/backward/iostream.h")
>      (gcc-include "                 from test_clt.cc:1:"
>       1 nil 1 "test_clt.cc")
> +    ;; Lua
> +    (lua "lua: database.lua:10: assertion failed!"
> +         6 nil 10 "database.lua")
> +    (lua "/usr/local/bin/lua: core/database.lua:20: assertion failed!"
> +         21 nil 20 "core/database.lua")
> +    (lua-stack "     database.lua:10: in field 'statement'"
> +                     2 nil 10 "database.lua" 0)
> +    (lua-stack "     core/database.lua:20: in field 'statement'"
> +                     2 nil 20 "core/database.lua" 0)
>      ;; gmake
>      (gmake "make: *** [Makefile:20: all] Error 2" 12 nil 20 "Makefile" 0)
>      (gmake "make[4]: *** [sub/make.mk:19: all] Error 127" 15 nil 19
> @@ -499,9 +508,9 @@ compile-test-error-regexps
>            (compilation-num-warnings-found 0)
>            (compilation-num-infos-found 0))
>        (mapc #'compile--test-error-line compile-tests--test-regexps-data)
> -      (should (eq compilation-num-errors-found 100))
> +      (should (eq compilation-num-errors-found 102))
>        (should (eq compilation-num-warnings-found 35))
> -      (should (eq compilation-num-infos-found 28)))))
> +      (should (eq compilation-num-infos-found 30)))))
>
>  (ert-deftest compile-test-grep-regexps ()
>    "Test the `grep-regexp-alist' regexps.
> --
> 2.37.1 (Apple Git-137.1)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]