From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: john muhl via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#65673: [PATCH] Add lua-ts-mode Date: Sat, 9 Sep 2023 10:17:21 -0500 Message-ID: <20230909151834.3613907-2-jm@pub.pink> References: <169352253839.28940.16024479871485106701-0@git.sr.ht> <20230909151834.3613907-1-jm@pub.pink> Reply-To: john muhl Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1024"; mail-complaints-to="usenet@ciao.gmane.io" Cc: philipk@posteo.net, john muhl , arstoffel@gmail.com, maurooaranda@gmail.com, ~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 Sat Sep 09 17:19:19 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 1qezjz-000AcS-1d for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Sep 2023 17:19:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qezjh-0006s1-5m; Sat, 09 Sep 2023 11:19:01 -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 1qezjf-0006rb-Dz for bug-gnu-emacs@gnu.org; Sat, 09 Sep 2023 11:18: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 1qezjf-0004qY-5n for bug-gnu-emacs@gnu.org; Sat, 09 Sep 2023 11:18:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qezji-00058R-1V for bug-gnu-emacs@gnu.org; Sat, 09 Sep 2023 11:19: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: Sat, 09 Sep 2023 15:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65673 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 65673-submit@debbugs.gnu.org id=B65673.169427274019725 (code B ref 65673); Sat, 09 Sep 2023 15:19:02 +0000 Original-Received: (at 65673) by debbugs.gnu.org; 9 Sep 2023 15:19:00 +0000 Original-Received: from localhost ([127.0.0.1]:48272 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qezje-000582-Ae for submit@debbugs.gnu.org; Sat, 09 Sep 2023 11:18:59 -0400 Original-Received: from out-218.mta0.migadu.com ([91.218.175.218]:23493) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qezja-00057l-Os for 65673@debbugs.gnu.org; Sat, 09 Sep 2023 11:18:56 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pub.pink; s=key1; t=1694272730; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3lc9ueFZGJqv766qjJjaZ4tp+QUEGPWYUeUcOtPxMXs=; b=ZDv38EM/b6NY3KoJ4z04B98Z3WRT/QrxaW87uVseTg56Li+coDIWFp0Y0q4A7XGD/LknDQ 7EKk1K9BgGkDfuOVB58ONYujyenoQ8VpUGyjMDSnf8PMsbV11Q5xZOxs/N8l5G+Bf4tCQZ 80c/a+qXTgOggXfpeQT0CclPv9wb4Gc= In-Reply-To: <20230909151834.3613907-1-jm@pub.pink> X-Migadu-Flow: FLOW_OUT 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: , X-ACL-Warn: , john muhl 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:269874 Archived-At: * lisp/progmodes/lua-ts-mode.el: * test/lisp/progmodes/lua-ts-mode-resources/indent.erts: * test/lisp/progmodes/lua-ts-mode-tests.el: New file. * etc/NEWS: Mention new mode. * lisp/progmodes/eglot.el (eglot-server-programs): * lisp/progmodes/hideshow.el (hs-special-modes-alist): Support lua-ts-mode. * admin/notes/tree-sitter/build-module/batch.sh: * admin/notes/tree-sitter/build-module/build.sh: Add Lua. * test/infra/Dockerfile.emba: * test/infra/test-jobs.yml: Include lua-ts-mode tests. --- 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 | 4 +- lisp/progmodes/hideshow.el | 1 + lisp/progmodes/lua-ts-mode.el | 419 +++++++++++++ test/infra/Dockerfile.emba | 1 + test/infra/test-jobs.yml | 1 + .../lua-ts-mode-resources/indent.erts | 152 +++++ .../lua-ts-mode-resources/movement.erts | 553 ++++++++++++++++++ test/lisp/progmodes/lua-ts-mode-tests.el | 36 ++ 11 files changed, 1173 insertions(+), 2 deletions(-) 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-resources/movement.erts create mode 100644 test/lisp/progmodes/lua-ts-mode-tests.el diff --git a/admin/notes/tree-sitter/build-module/batch.sh b/admin/notes/tree-sitter/build-module/batch.sh index 3c4e1472c89..9988d1eae4e 100755 --- a/admin/notes/tree-sitter/build-module/batch.sh +++ b/admin/notes/tree-sitter/build-module/batch.sh @@ -16,6 +16,7 @@ languages= 'java' 'javascript' 'json' + 'lua' 'python' 'rust' 'toml' diff --git a/admin/notes/tree-sitter/build-module/build.sh b/admin/notes/tree-sitter/build-module/build.sh index 0832875168b..969187b7f92 100755 --- a/admin/notes/tree-sitter/build-module/build.sh +++ b/admin/notes/tree-sitter/build-module/build.sh @@ -42,6 +42,9 @@ grammardir= "heex") org="phoenixframework" ;; + "lua") + org="MunifTanjim" + ;; "typescript") sourcedir="tree-sitter-typescript/typescript/src" grammardir="tree-sitter-typescript/typescript" diff --git a/etc/NEWS b/etc/NEWS index 51e89fc96dd..0b7da8b392c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -782,6 +782,10 @@ It highlight parens via ‘show-paren-mode’ and ‘blink-matching-paren’ in a user-friendly way, avoids reporting alleged paren mismatches and makes sexp navigation more intuitive. +--- +*** New major mode 'lua-ts-mode'. +A major mode based on the tree-sitter library for editing Lua files. + --- ** The highly accessible Modus themes collection has eight items. The 'modus-operandi' and 'modus-vivendi' are the main themes that have diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index f7c7c29c094..e2f663998d3 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -268,8 +268,8 @@ eglot-server-programs (gdscript-mode . ("localhost" 6008)) ((fortran-mode f90-mode) . ("fortls")) (futhark-mode . ("futhark" "lsp")) - (lua-mode . ,(eglot-alternatives - '("lua-language-server" "lua-lsp"))) + ((lua-mode lua-ts-mode) . ,(eglot-alternatives + '("lua-language-server" "lua-lsp"))) (zig-mode . ("zls")) ((css-mode css-ts-mode) . ,(eglot-alternatives '(("vscode-css-language-server" "--stdio") diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index b878986d7a4..78e39fad740 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el @@ -264,6 +264,7 @@ hs-special-modes-alist (java-ts-mode "{" "}" "/[*/]" nil nil) (js-mode "{" "}" "/[*/]" nil) (js-ts-mode "{" "}" "/[*/]" nil) + (lua-ts-mode "{\\|\\[\\[" "}\\|\\]\\]" "--" nil) (mhtml-mode "{\\|<[^/>]*?" "}\\|]*[^/]>" "