From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: ~johnmuhl Newsgroups: gmane.emacs.bugs Subject: bug#65673: [PATCH emacs 0/1] Add lua-ts-mode Date: Thu, 31 Aug 2023 22:55:38 +0000 Message-ID: <169352253839.28940.16024479871485106701-0@git.sr.ht> Reply-To: ~johnmuhl 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="5832"; mail-complaints-to="usenet@ciao.gmane.io" Cc: ~emacs/emacs-devel@lists.sr.ht To: 65673@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 01 08:31:37 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 1qbxgu-0001Le-Ud for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 Sep 2023 08:31:37 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbxgf-0007Ft-FM; Fri, 01 Sep 2023 02:31:21 -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 1qbxgF-00074D-02 for bug-gnu-emacs@gnu.org; Fri, 01 Sep 2023 02:31:03 -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 1qbxgE-0001vg-MA for bug-gnu-emacs@gnu.org; Fri, 01 Sep 2023 02:30:54 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qbxgN-0003mb-La for bug-gnu-emacs@gnu.org; Fri, 01 Sep 2023 02:31:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: ~johnmuhl Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Sep 2023 06:31:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 65673 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.169354983314458 (code B ref -1); Fri, 01 Sep 2023 06:31:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Sep 2023 06:30:33 +0000 Original-Received: from localhost ([127.0.0.1]:59726 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qbxfs-0003l2-8R for submit@debbugs.gnu.org; Fri, 01 Sep 2023 02:30:32 -0400 Original-Received: from lists.gnu.org ([2001:470:142::17]:53778) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qbqaF-0000w7-FP for submit@debbugs.gnu.org; Thu, 31 Aug 2023 18:56:16 -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 1qbqZv-0003iy-Gv for bug-gnu-emacs@gnu.org; Thu, 31 Aug 2023 18:55:55 -0400 Original-Received: from mail-b.sr.ht ([173.195.146.151]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbqZg-0002hk-Dx for bug-gnu-emacs@gnu.org; Thu, 31 Aug 2023 18:55:46 -0400 Authentication-Results: mail-b.sr.ht; dkim=none Original-Received: from git.sr.ht (unknown [173.195.146.142]) by mail-b.sr.ht (Postfix) with ESMTPSA id 9F04B11F230; Thu, 31 Aug 2023 22:55:38 +0000 (UTC) X-Mailer: git.sr.ht Received-SPF: pass client-ip=173.195.146.151; envelope-from=outgoing@sr.ht; helo=mail-b.sr.ht X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 01 Sep 2023 02:30:26 -0400 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:268867 Archived-At: This email and patch were generated and sent using the web based =E2=80=9CPrepare a patchset=E2=80=9D feature of Sourcehut. I hope it will be = a useful POC for how Emacs could integrate a forge based pull request style workflow for occasional contributors with (hopefully) minimal hassle for those with push access. If it causes too much annoyance I=E2=80=99m happy to resend it the preferred way. I=E2=80=99ve also CC=E2=80=99d a Sourcehut mailing list to test the patch rev= iew feature so if this experiment continues it=E2=80=99d be good if we could keep =E2=80=9C~emacs/emacs-devel@lists.sr.ht=E2=80=9D included in any replies. Oth= er than that just do the usual patch review/handling. The sr.ht hosted version of the Sourcehut forge is considered =E2=80=9CGood enough to recommend=E2=80=9D by the GNU Ethical Repository Criteria in case anyone wonders about that. https://www.gnu.org/software/repo-criteria-evaluation.html Discussion or questions about Sourcehut or the workflow should probably go somewhere else but please CC me in that case. Thanks. //// This patch adds a lua-ts-mode for editing Lua files in Emacs >=3D 29.1. It is comparable in features to the NonGNU ELPA lua-mode. Shortcomings in the partially supported features are mentioned below. | Feature | lua-mode | lua-ts-mode | |------------------------+----------+-------------| | indentation =C2=B9 | Yes | Yes | | highlighting | Yes | Yes | | documentation lookup =C2=B2 | Yes | Yes | | imenu support =C2=B3 | Yes | Partial | | hideshow support | Yes | Yes | | outline support | No | Yes | | flymake support =E2=81=B4 | Yes | Yes | | which-func support | No | Yes | | inferior Lua =E2=81=B5 | Yes | Partial | 1. Indentation tries to follow the default EmmyLua style. This is the same formatter used by lua-ls so out of the box eglot-format and automatic indentation should agree about indents. 2. Both modes implement this feature by calling browse-url for the manual.html file that is normally distributed with Lua. lua-mode has a fallback that uses an online version, lua-ts-mode has no fallback but works with the online docs if customized. 3. I tried to follow the model used in other ts modes but it doesn=E2=80=99t seem like the results are very useful compared to Eglot/lua-ls. I=E2=80=99d like it to improve eventually but it=E2=80=99s low priority personally and wouldn=E2=80=99t oppose removing it for now. 4. Both modes require the Luacheck program to be installed. 5. The comint integration is the most basic. lua-mode supports things like "Send {buffer,region} to process" which I=E2=80=99d like to add but haven=E2=80=99t had time. Currently lua-ts-mode only supports starting an inferior Lua process and interacting with it directly. The patch file is also available from: https://git.sr.ht/~johnmuhl/emacs/commit/391699e.patch Thanks again. john muhl (1): Add lua-ts-mode admin/notes/tree-sitter/build-module/batch.sh | 1 + admin/notes/tree-sitter/build-module/build.sh | 3 + etc/NEWS | 4 + lisp/progmodes/eglot.el | 2 +- lisp/progmodes/hideshow.el | 1 + lisp/progmodes/lua-ts-mode.el | 457 ++++++++++++++++++ test/infra/Dockerfile.emba | 1 + test/infra/test-jobs.yml | 1 + .../lua-ts-mode-resources/indent.erts | 152 ++++++ test/lisp/progmodes/lua-ts-mode-tests.el | 32 ++ 10 files changed, 653 insertions(+), 1 deletion(-) create mode 100644 lisp/progmodes/lua-ts-mode.el create mode 100644 test/lisp/progmodes/lua-ts-mode-resources/indent.erts create mode 100644 test/lisp/progmodes/lua-ts-mode-tests.el --=20 2.38.5