From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Rudolf =?UTF-8?Q?Adamkovi=C4=8D?= via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#60830: 30.0.50; The *Compilation* buffer does not recognize Lua errors Date: Thu, 05 Oct 2023 18:21:02 +0200 Message-ID: References: <909EF5E1-6F30-4A35-84E8-2EF4333115FD@gmail.com> Reply-To: Rudolf =?UTF-8?Q?Adamkovi=C4=8D?= Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16260"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60830@debbugs.gnu.org, Stefan Kangas , Stefan Monnier To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 05 18:21:50 2023 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 1qoR6k-0003xW-L1 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 05 Oct 2023 18:21:50 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qoR6g-0002GR-2O; Thu, 05 Oct 2023 12:21:46 -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 1qoR6e-0002G0-FH for bug-gnu-emacs@gnu.org; Thu, 05 Oct 2023 12:21:44 -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 1qoR6e-0005k5-4J for bug-gnu-emacs@gnu.org; Thu, 05 Oct 2023 12:21:44 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qoR6w-00059u-6E for bug-gnu-emacs@gnu.org; Thu, 05 Oct 2023 12:22:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Rudolf =?UTF-8?Q?Adamkovi=C4=8D?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 Oct 2023 16:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60830 X-GNU-PR-Package: emacs Original-Received: via spool by 60830-submit@debbugs.gnu.org id=B60830.169652292019822 (code B ref 60830); Thu, 05 Oct 2023 16:22:02 +0000 Original-Received: (at 60830) by debbugs.gnu.org; 5 Oct 2023 16:22:00 +0000 Original-Received: from localhost ([127.0.0.1]:48353 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoR6u-00059e-3G for submit@debbugs.gnu.org; Thu, 05 Oct 2023 12:22:00 -0400 Original-Received: from ms11p00im-qufo17291601.me.com ([17.58.38.45]:34330) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoR6r-00059N-9a for 60830@debbugs.gnu.org; Thu, 05 Oct 2023 12:21:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1696522893; bh=UJ/uuTjZ/YdHvT1ENfMUk2VPTCVKVkNVT0aZhHoUuqE=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=b++6jeEO979GeuuNGPNsxtPT93XaDokmEGdogqK0yGcAkBggDVpHpiCopeEx8GPB8 gdl676oyPB5lWY2zk67hiIPVIJcMG/enWwV9WG9XBOTXBbqay9aZ3AzMmpyiBtgF/9 qygzbMDuD3cnIJW2V6kvzUfZQl5oty5CsjnrJSI/chzdfqrPc6z1VRmG3ia1DGOFUx ppgXk6sr3YUVvnAkED9AjBfucY9hgE6zf7uPIsjufEHjnYSy2mCm3lZn4E5zFh+WjA kd1Cb6btZJz+qN3whw1ez0efHU8D1g0yOXWzVZIVt3CzMdV2B4FFhJybtDBg+s+7Ht Esb4qHmBzESJQ== Original-Received: from Rudolfs-MacBook-Air.local (ms11p00im-dlb-asmtpmailmevip.me.com [17.57.154.19]) by ms11p00im-qufo17291601.me.com (Postfix) with ESMTPSA id 058CB3A0506; Thu, 5 Oct 2023 16:21:21 +0000 (UTC) In-Reply-To: <909EF5E1-6F30-4A35-84E8-2EF4333115FD@gmail.com> X-Proofpoint-GUID: GBYi0yaVXpkyjvshrVGqlG8DXLDaJunQ X-Proofpoint-ORIG-GUID: GBYi0yaVXpkyjvshrVGqlG8DXLDaJunQ X-Proofpoint-Virus-Version: vendor=fsecure engine=1.1.170-22c6f66c430a71ce266a39bfe25bc2903e8d5c8f:6.0.425, 18.0.572, 17.0.605.474.0000000 definitions=2022-01-14_01:2022-01-14_01, 2020-02-14_11, 2020-01-23_02 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=963 bulkscore=0 spamscore=0 adultscore=0 suspectscore=0 malwarescore=0 clxscore=1011 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2310050128 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:271889 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mattias Engdeg=C3=A5rd writes: > This pattern matches some lines normally matched by the `gnu` rule > which comes later in the rule list. I don't know if it's a big problem > -- it may cause misclassification of some messages which should be of > 'warning' or 'info' type. Good to know! So, I studied 'luaL_traceback' in 'lauxlib.c' in Lua and made the regular expression more precise. No more mis-classification! > I'm actually slightly more bothered by this message because it would > conflict with possible future (re-)relaxation of the `gnu` rule with > respect to leading whitespace. The matter does come up from time to > time, and it would be nice to at least have the option to do that. Ditto; I made other expression more precise as well! > The 'omake' rule has now been disabled by default for other reasons > (it's something that has been discussed in the past), so there is at > least precedence for doing this. /Note:/ I rebased on top of 'master' (and so the 'omake' patch). See the new patch, with more precise regular expressions, attached below. While on it, I also added support for stack frames with no line number, as per Lua source code. Lastly, I added a NEWS entry, as well as, improved the commit message a bit. How about now? :) Rudy --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Make-the-Compilation-mode-recognize-Lua-errors.patch >From a267051c042b89b650e2a15597d226fe26579826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= 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. This patch further improves Lua support in Emacs by making the Compilation mode recognize Lua errors and stack traces. 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'. --- etc/NEWS | 5 +++++ lisp/progmodes/compile.el | 7 +++++++ test/lisp/progmodes/compile-tests.el | 15 +++++++++++++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 12c2d52a4ab..cf98e8d6f43 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -307,6 +307,11 @@ This is because it partly acts by modifying other rules which may occasionally be surprising. It can be re-enabled by adding 'omake' to 'compilation-error-regexp-alist'. +*** Lua errors and stack traces are now recognized. +The compilation mode now recognizes Lua language errors and stack +traces. Every Lua error is recognized as a compilation error, and +every Lua stack frame is recognized as a compilation info. + ** VC --- diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 9e441dbfcf7..97d4be52286 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -362,6 +362,13 @@ compilation-error-regexp-alist-alist (ruby-Test::Unit "^ [[ ]?\\([^ (].*\\):\\([1-9][0-9]*\\)\\(\\]\\)?:in " 1 2) + (lua + "^[^:\n\t]+: \\([^: \n\t]+\\):\\([0-9]+\\): .*?\nstack traceback:\n\t" + 1 2 nil 2 1) + (lua-stack + "^\t\\([^:\n\t]+\\):\\(\\([0-9]+\\):\\)? in " + 1 3 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 d497644c389..18c422a5afe 100644 --- a/test/lisp/progmodes/compile-tests.el +++ b/test/lisp/progmodes/compile-tests.el @@ -206,6 +206,17 @@ 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!\nstack traceback:\n\t" + 6 nil 10 "database.lua") + (lua "/usr/local/bin/lua: core/database.lua:20: assertion failed!\nstack traceback:\n\t" + 21 nil 20 "core/database.lua") + (lua-stack " database.lua: in field 'statement'" + 2 nil nil "database.lua" 0) + (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 @@ -507,9 +518,9 @@ compile-test-error-regexps 1 15 5 "alpha.c"))) (compile--test-error-line test)) - (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 31))))) (ert-deftest compile-test-grep-regexps () "Test the `grep-regexp-alist' regexps. -- 2.39.3 (Apple Git-145) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable --=20 "If you're thinking without writing, you only think you're thinking." --- Leslie Lamport Rudolf Adamkovi=C4=8D [he/him] Studenohorsk=C3=A1 25 84103 Bratislava Slovakia --=-=-=--