unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#66466: [PATCH] Support lua-ts-mode in align.el
@ 2023-10-11 16:57 john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-10-12  7:35 ` Stefan Kangas
  0 siblings, 1 reply; 10+ messages in thread
From: john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-10-11 16:57 UTC (permalink / raw)
  To: 66466

[-- Attachment #1: Type: text/plain, Size: 56 bytes --]

Tags: patch

Add support for using align in Lua files.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Support-lua-ts-mode-in-align.el.patch --]
[-- Type: text/patch, Size: 4132 bytes --]

From 4ba4f08b1c9e11b19c52a946917145ab08b989d6 Mon Sep 17 00:00:00 2001
From: john muhl <jm@pub.pink>
Date: Tue, 10 Oct 2023 09:18:10 -0500
Subject: [PATCH] Support lua-ts-mode in align.el

* lisp/align.el (align-rules-list): Add lua-ts-mode.
* lisp/progmodes/lua-ts-mode.el (lua-ts-mode): Indent region
before aligning.
* test/lisp/align-tests.el (align-lua):
* test/lisp/align-resources/lua-ts-mode.erts: Add tests.
---
 lisp/align.el                              | 18 +++++-
 lisp/progmodes/lua-ts-mode.el              |  3 +
 test/lisp/align-resources/lua-ts-mode.erts | 67 ++++++++++++++++++++++
 test/lisp/align-tests.el                   |  6 ++
 4 files changed, 93 insertions(+), 1 deletion(-)
 create mode 100644 test/lisp/align-resources/lua-ts-mode.erts

diff --git a/lisp/align.el b/lisp/align.el
index a286addb51f..e6e62ce5726 100644
--- a/lisp/align.el
+++ b/lisp/align.el
@@ -577,7 +577,23 @@ align-rules-list
                     "="
                     (group (zero-or-more (syntax whitespace)))))
      (group . (1 2))
-     (modes . '(conf-toml-mode toml-ts-mode))))
+     (modes . '(conf-toml-mode toml-ts-mode)))
+
+    (lua-assignment
+     (regexp   . ,(concat "\\(?:^\\(?:\\s-*\\(?:local\\s-+\\)?\\(?:[,<>_]"
+                          "\\|\\w\\)+\\)+\\(\\s-*\\)=\\(\\s-*\\)\\)"))
+     (group    . (1 2))
+     (modes    . '(lua-ts-mode))
+     (tab-stop . nil))
+
+    (lua-comment
+     (regexp   . "\\(?:\\(\\s-*\\)--.*\\)")
+     (modes    . '(lua-ts-mode))
+     (column   . comment-column)
+     (valid    . ,(lambda ()
+                    (save-excursion
+                      (goto-char (match-beginning 1))
+                      (not (bolp)))))))
   "A list describing all of the available alignment rules.
 The format is:
 
diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el
index 224199dff74..8db6816d6e4 100644
--- a/lisp/progmodes/lua-ts-mode.el
+++ b/lisp/progmodes/lua-ts-mode.el
@@ -472,6 +472,9 @@ lua-ts-mode
                                            "function"))
                                   symbol-end)))))
 
+    ;; Align.
+    (setq-local align-indent-before-aligning t)
+
     (treesit-major-mode-setup))
 
   (add-hook 'flymake-diagnostic-functions #'lua-ts-flymake-luacheck nil 'local))
diff --git a/test/lisp/align-resources/lua-ts-mode.erts b/test/lisp/align-resources/lua-ts-mode.erts
new file mode 100644
index 00000000000..ad67c331787
--- /dev/null
+++ b/test/lisp/align-resources/lua-ts-mode.erts
@@ -0,0 +1,67 @@
+Name: align assignments
+
+=-=
+local first=1
+local second=2
+local last=3
+=-=
+local first  = 1
+local second = 2
+local last   = 3
+=-=-=
+
+Name: align fields
+
+=-=
+local Table={
+first=1,
+second=2,
+last=3,
+}
+=-=
+local Table = {
+    first   = 1,
+    second  = 2,
+    last    = 3,
+}
+=-=-=
+
+Name: align comments
+
+=-=
+local first-- 1
+local second -- 2
+local last	 -- 3
+=-=
+local first         -- 1
+local second        -- 2
+local last          -- 3
+=-=-=
+
+Name: align assignments and comments
+
+=-=
+local first=1--one
+local second=2 --two
+local last=3	 --three
+=-=
+local first  = 1    --one
+local second = 2    --two
+local last   = 3    --three
+=-=-=
+
+Name: align fields and comments
+
+=-=
+local T={
+first=1,--one
+second=2, --two
+last=3,	 --three
+}
+=-=
+local T    = {
+    first  = 1,     --one
+    second = 2,     --two
+    last   = 3,     --three
+}
+=-=-=
diff --git a/test/lisp/align-tests.el b/test/lisp/align-tests.el
index a4d9303827f..4216ad95f4b 100644
--- a/test/lisp/align-tests.el
+++ b/test/lisp/align-tests.el
@@ -49,6 +49,12 @@ align-latex
   (ert-test-erts-file (ert-resource-file "latex-mode.erts")
                       (test-align-transform-fun #'latex-mode)))
 
+(ert-deftest align-lua ()
+  (let ((comment-column 20)
+        (indent-tabs-mode nil))
+    (ert-test-erts-file (ert-resource-file "lua-ts-mode.erts")
+                        (test-align-transform-fun #'lua-ts-mode))))
+
 (ert-deftest align-python ()
   (ert-test-erts-file (ert-resource-file "python-mode.erts")
                       (test-align-transform-fun #'python-mode)))
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#66466: [PATCH] Support lua-ts-mode in align.el
  2023-10-11 16:57 bug#66466: [PATCH] Support lua-ts-mode in align.el john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-10-12  7:35 ` Stefan Kangas
  2023-10-12  8:36   ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-10-13  3:13   ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 10+ messages in thread
From: Stefan Kangas @ 2023-10-12  7:35 UTC (permalink / raw)
  To: john muhl, 66466

john muhl via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs@gnu.org> writes:

> Add support for using align in Lua files.

nThanks.

> diff --git a/lisp/align.el b/lisp/align.el
> index a286addb51f..e6e62ce5726 100644
> --- a/lisp/align.el
> +++ b/lisp/align.el
> @@ -577,7 +577,23 @@ align-rules-list
>                      "="
>                      (group (zero-or-more (syntax whitespace)))))
>       (group . (1 2))
> -     (modes . '(conf-toml-mode toml-ts-mode))))
> +     (modes . '(conf-toml-mode toml-ts-mode)))
> +
> +    (lua-assignment
> +     (regexp   . ,(concat "\\(?:^\\(?:\\s-*\\(?:local\\s-+\\)?\\(?:[,<>_]"
> +                          "\\|\\w\\)+\\)+\\(\\s-*\\)=\\(\\s-*\\)\\)"))
> +     (group    . (1 2))
> +     (modes    . '(lua-ts-mode))
> +     (tab-stop . nil))
> +
> +    (lua-comment
> +     (regexp   . "\\(?:\\(\\s-*\\)--.*\\)")
> +     (modes    . '(lua-ts-mode))
> +     (column   . comment-column)
> +     (valid    . ,(lambda ()
> +                    (save-excursion
> +                      (goto-char (match-beginning 1))
> +                      (not (bolp)))))))

Should `lua-mode' also be in `modes'?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#66466: [PATCH] Support lua-ts-mode in align.el
  2023-10-12  7:35 ` Stefan Kangas
@ 2023-10-12  8:36   ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-10-12 11:20     ` Stefan Kangas
  2023-10-14  2:19     ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-10-13  3:13   ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 2 replies; 10+ messages in thread
From: Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-10-12  8:36 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 66466, john muhl

Hi,

Stefan Kangas <stefankangas@gmail.com> writes:

> john muhl via "Bug reports for GNU Emacs, the Swiss army knife of text
> editors" <bug-gnu-emacs@gnu.org> writes:
>
>> Add support for using align in Lua files.
>
> nThanks.
>
>> diff --git a/lisp/align.el b/lisp/align.el
>> index a286addb51f..e6e62ce5726 100644
>> --- a/lisp/align.el
>> +++ b/lisp/align.el
>> @@ -577,7 +577,23 @@ align-rules-list
>>                      "="
>>                      (group (zero-or-more (syntax whitespace)))))
>>       (group . (1 2))
>> -     (modes . '(conf-toml-mode toml-ts-mode))))
>> +     (modes . '(conf-toml-mode toml-ts-mode)))
>> +
>> +    (lua-assignment
>> +     (regexp   . ,(concat "\\(?:^\\(?:\\s-*\\(?:local\\s-+\\)?\\(?:[,<>_]"
>> +                          "\\|\\w\\)+\\)+\\(\\s-*\\)=\\(\\s-*\\)\\)"))
>> +     (group    . (1 2))
>> +     (modes    . '(lua-ts-mode))
>> +     (tab-stop . nil))
>> +
>> +    (lua-comment
>> +     (regexp   . "\\(?:\\(\\s-*\\)--.*\\)")
>> +     (modes    . '(lua-ts-mode))
>> +     (column   . comment-column)
>> +     (valid    . ,(lambda ()
>> +                    (save-excursion
>> +                      (goto-char (match-beginning 1))
>> +                      (not (bolp)))))))
>
> Should `lua-mode' also be in `modes'?

Another option would be for `lua-ts-mode` to define
`align-mode-rules-list` locally, instead of extending `align-rules-list`
globally.

Also, I noticed that we already have several similar rules for aligning
assignments and comments in `align-rules-list`.  Do none of them work
for Lua?  If so, I wonder what specifics of Lua's syntax make the
existing rules inapplicable.  Maybe one of the existing rules can be
extended instead.


Best,

Eshel





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#66466: [PATCH] Support lua-ts-mode in align.el
  2023-10-12  8:36   ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-10-12 11:20     ` Stefan Kangas
  2023-10-14  2:19     ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 10+ messages in thread
From: Stefan Kangas @ 2023-10-12 11:20 UTC (permalink / raw)
  To: Eshel Yaron; +Cc: 66466, john muhl

Eshel Yaron <me@eshelyaron.com> writes:

>> Should `lua-mode' also be in `modes'?
>
> Another option would be for `lua-ts-mode` to define
> `align-mode-rules-list` locally, instead of extending `align-rules-list`
> globally.

That's an option, but then sharing it between modes is harder.

FWIW, only prolog-mode seems to do it locally.

> Also, I noticed that we already have several similar rules for aligning
> assignments and comments in `align-rules-list`.  Do none of them work
> for Lua?  If so, I wonder what specifics of Lua's syntax make the
> existing rules inapplicable.  Maybe one of the existing rules can be
> extended instead.

Maybe, OTOH the list of rules is not that long.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#66466: [PATCH] Support lua-ts-mode in align.el
  2023-10-12  7:35 ` Stefan Kangas
  2023-10-12  8:36   ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-10-13  3:13   ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-10-15 14:25     ` Stefan Kangas
  1 sibling, 1 reply; 10+ messages in thread
From: john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-10-13  3:13 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 66466

Stefan Kangas <stefankangas@gmail.com> writes:

> john muhl via "Bug reports for GNU Emacs, the Swiss army knife of text
> editors" <bug-gnu-emacs@gnu.org> writes:
>
>> Add support for using align in Lua files.
>
> nThanks.
>
>> diff --git a/lisp/align.el b/lisp/align.el
>> index a286addb51f..e6e62ce5726 100644
>> --- a/lisp/align.el
>> +++ b/lisp/align.el
>> @@ -577,7 +577,23 @@ align-rules-list
>>                      "="
>>                      (group (zero-or-more (syntax whitespace)))))
>>       (group . (1 2))
>> -     (modes . '(conf-toml-mode toml-ts-mode))))
>> +     (modes . '(conf-toml-mode toml-ts-mode)))
>> +
>> +    (lua-assignment
>> +     (regexp   . ,(concat "\\(?:^\\(?:\\s-*\\(?:local\\s-+\\)?\\(?:[,<>_]"
>> +                          "\\|\\w\\)+\\)+\\(\\s-*\\)=\\(\\s-*\\)\\)"))
>> +     (group    . (1 2))
>> +     (modes    . '(lua-ts-mode))
>> +     (tab-stop . nil))
>> +
>> +    (lua-comment
>> +     (regexp   . "\\(?:\\(\\s-*\\)--.*\\)")
>> +     (modes    . '(lua-ts-mode))
>> +     (column   . comment-column)
>> +     (valid    . ,(lambda ()
>> +                    (save-excursion
>> +                      (goto-char (match-beginning 1))
>> +                      (not (bolp)))))))
>
> Should `lua-mode' also be in `modes'?

lua-mode is only available from non-GNU ELPA so I wasn’t sure. If that’s
not a factor I’ll add it.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#66466: [PATCH] Support lua-ts-mode in align.el
  2023-10-12  8:36   ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-10-12 11:20     ` Stefan Kangas
@ 2023-10-14  2:19     ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-10-21 10:27       ` Stefan Kangas
  1 sibling, 1 reply; 10+ messages in thread
From: john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-10-14  2:19 UTC (permalink / raw)
  To: Eshel Yaron; +Cc: 66466, Stefan Kangas

[-- Attachment #1: Type: text/plain, Size: 2320 bytes --]

Eshel Yaron <me@eshelyaron.com> writes:

> Hi,
>
> Stefan Kangas <stefankangas@gmail.com> writes:
>
>> john muhl via "Bug reports for GNU Emacs, the Swiss army knife of text
>> editors" <bug-gnu-emacs@gnu.org> writes:
>>
>>> Add support for using align in Lua files.
>>
>> nThanks.
>>
>>> diff --git a/lisp/align.el b/lisp/align.el
>>> index a286addb51f..e6e62ce5726 100644
>>> --- a/lisp/align.el
>>> +++ b/lisp/align.el
>>> @@ -577,7 +577,23 @@ align-rules-list
>>>                      "="
>>>                      (group (zero-or-more (syntax whitespace)))))
>>>       (group . (1 2))
>>> -     (modes . '(conf-toml-mode toml-ts-mode))))
>>> +     (modes . '(conf-toml-mode toml-ts-mode)))
>>> +
>>> +    (lua-assignment
>>> +     (regexp   . ,(concat "\\(?:^\\(?:\\s-*\\(?:local\\s-+\\)?\\(?:[,<>_]"
>>> +                          "\\|\\w\\)+\\)+\\(\\s-*\\)=\\(\\s-*\\)\\)"))
>>> +     (group    . (1 2))
>>> +     (modes    . '(lua-ts-mode))
>>> +     (tab-stop . nil))
>>> +
>>> +    (lua-comment
>>> +     (regexp   . "\\(?:\\(\\s-*\\)--.*\\)")
>>> +     (modes    . '(lua-ts-mode))
>>> +     (column   . comment-column)
>>> +     (valid    . ,(lambda ()
>>> +                    (save-excursion
>>> +                      (goto-char (match-beginning 1))
>>> +                      (not (bolp)))))))
>>
>> Should `lua-mode' also be in `modes'?
>
> Another option would be for `lua-ts-mode` to define
> `align-mode-rules-list` locally, instead of extending `align-rules-list`
> globally.
>
> Also, I noticed that we already have several similar rules for aligning
> assignments and comments in `align-rules-list`.  Do none of them work
> for Lua?

The toml-assignment rule works well enough. I added the Lua modes there
now.

> If so, I wonder what specifics of Lua's syntax make the existing rules
> inapplicable.

For comments I only see the open-comment and c++-comment rules.
open-comment doesn’t match trailing line comments. Extending c++-comment
in the obvious way (Lua uses "--" for comment start) causes trouble with
c++ code like:

  int x = 5; // declare
  x--; // decrement

Lua shares comment syntax with at least Ada, Haskell, SQL and VHDL so I
changed the name of the rule to double-dash-comment and added the Lua
modes there.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Support-lua-ts-mode-in-align.el.patch --]
[-- Type: text/x-patch, Size: 4010 bytes --]

From ac444d12b7a6098bb609a0b9e48c19094ba2be7d Mon Sep 17 00:00:00 2001
From: john muhl <jm@pub.pink>
Date: Tue, 10 Oct 2023 09:18:10 -0500
Subject: [PATCH] Support lua-ts-mode in align.el

* lisp/align.el (align-rules-list): Add lua-ts-mode.
* lisp/progmodes/lua-ts-mode.el (lua-ts-mode): Indent region
before aligning.
* test/lisp/align-tests.el (align-lua):
* test/lisp/align-resources/lua-ts-mode.erts: Add tests.
---
 lisp/align.el                              | 13 ++++-
 lisp/progmodes/lua-ts-mode.el              |  3 +
 test/lisp/align-resources/lua-ts-mode.erts | 67 ++++++++++++++++++++++
 test/lisp/align-tests.el                   |  6 ++
 4 files changed, 88 insertions(+), 1 deletion(-)
 create mode 100644 test/lisp/align-resources/lua-ts-mode.erts

diff --git a/lisp/align.el b/lisp/align.el
index a286addb51f..9fa78525ecb 100644
--- a/lisp/align.el
+++ b/lisp/align.el
@@ -577,7 +577,18 @@ align-rules-list
                     "="
                     (group (zero-or-more (syntax whitespace)))))
      (group . (1 2))
-     (modes . '(conf-toml-mode toml-ts-mode))))
+     (modes . '(conf-toml-mode toml-ts-mode lua-mode lua-ts-mode)))
+
+    (double-dash-comment
+     (regexp . ,(rx (group (zero-or-more (syntax whitespace)))
+                    "--"
+                    (zero-or-more nonl)))
+     (modes  . '(lua-mode lua-ts-mode))
+     (column . comment-column)
+     (valid  . ,(lambda ()
+                  (save-excursion
+                    (goto-char (match-beginning 1))
+                    (not (bolp)))))))
   "A list describing all of the available alignment rules.
 The format is:
 
diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el
index 224199dff74..8db6816d6e4 100644
--- a/lisp/progmodes/lua-ts-mode.el
+++ b/lisp/progmodes/lua-ts-mode.el
@@ -472,6 +472,9 @@ lua-ts-mode
                                            "function"))
                                   symbol-end)))))
 
+    ;; Align.
+    (setq-local align-indent-before-aligning t)
+
     (treesit-major-mode-setup))
 
   (add-hook 'flymake-diagnostic-functions #'lua-ts-flymake-luacheck nil 'local))
diff --git a/test/lisp/align-resources/lua-ts-mode.erts b/test/lisp/align-resources/lua-ts-mode.erts
new file mode 100644
index 00000000000..b0473ad6cdf
--- /dev/null
+++ b/test/lisp/align-resources/lua-ts-mode.erts
@@ -0,0 +1,67 @@
+Name: align assignments
+
+=-=
+local first=1
+local s <const> =2
+local last=3
+=-=
+local first     = 1
+local s <const> = 2
+local last      = 3
+=-=-=
+
+Name: align fields
+
+=-=
+local Table={
+first=1,
+second=2,
+last=3,
+}
+=-=
+local Table = {
+    first   = 1,
+    second  = 2,
+    last    = 3,
+}
+=-=-=
+
+Name: align comments
+
+=-=
+local first-- 1
+local second -- 2
+local last	 -- 3
+=-=
+local first         -- 1
+local second        -- 2
+local last          -- 3
+=-=-=
+
+Name: align assignments and comments
+
+=-=
+local first=1-- one
+local second=2 -- two
+local last=3	 -- three
+=-=
+local first  = 1    -- one
+local second = 2    -- two
+local last   = 3    -- three
+=-=-=
+
+Name: align fields and comments
+
+=-=
+local T={
+first=1,--one
+second=2, --two
+last=3,	 --three
+}
+=-=
+local T    = {
+    first  = 1,     --one
+    second = 2,     --two
+    last   = 3,     --three
+}
+=-=-=
diff --git a/test/lisp/align-tests.el b/test/lisp/align-tests.el
index a4d9303827f..4216ad95f4b 100644
--- a/test/lisp/align-tests.el
+++ b/test/lisp/align-tests.el
@@ -49,6 +49,12 @@ align-latex
   (ert-test-erts-file (ert-resource-file "latex-mode.erts")
                       (test-align-transform-fun #'latex-mode)))
 
+(ert-deftest align-lua ()
+  (let ((comment-column 20)
+        (indent-tabs-mode nil))
+    (ert-test-erts-file (ert-resource-file "lua-ts-mode.erts")
+                        (test-align-transform-fun #'lua-ts-mode))))
+
 (ert-deftest align-python ()
   (ert-test-erts-file (ert-resource-file "python-mode.erts")
                       (test-align-transform-fun #'python-mode)))
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#66466: [PATCH] Support lua-ts-mode in align.el
  2023-10-13  3:13   ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-10-15 14:25     ` Stefan Kangas
  2023-10-15 14:59       ` Philip Kaludercic
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Kangas @ 2023-10-15 14:25 UTC (permalink / raw)
  To: john muhl; +Cc: Philip Kaludercic, 66466

john muhl <jm@pub.pink> writes:

>> Should `lua-mode' also be in `modes'?
>
> lua-mode is only available from non-GNU ELPA so I wasn’t sure. If that’s
> not a factor I’ll add it.

No, it's not a factor, I think.

I don't know why lua-mode is not in NonGNU ELPA.  Perhaps it should be.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#66466: [PATCH] Support lua-ts-mode in align.el
  2023-10-15 14:25     ` Stefan Kangas
@ 2023-10-15 14:59       ` Philip Kaludercic
  2023-10-15 15:18         ` Stefan Kangas
  0 siblings, 1 reply; 10+ messages in thread
From: Philip Kaludercic @ 2023-10-15 14:59 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 66466, john muhl

Stefan Kangas <stefankangas@gmail.com> writes:

> john muhl <jm@pub.pink> writes:
>
>>> Should `lua-mode' also be in `modes'?
>>
>> lua-mode is only available from non-GNU ELPA so I wasn’t sure. If that’s
>> not a factor I’ll add it.
>
> No, it's not a factor, I think.
>
> I don't know why lua-mode is not in NonGNU ELPA.  Perhaps it should be.

It is included in NonGNU ELPA?

https://git.savannah.gnu.org/cgit/emacs/nongnu.git/tree/elpa-packages#n410





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#66466: [PATCH] Support lua-ts-mode in align.el
  2023-10-15 14:59       ` Philip Kaludercic
@ 2023-10-15 15:18         ` Stefan Kangas
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Kangas @ 2023-10-15 15:18 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 66466, john muhl

Philip Kaludercic <philipk@posteo.net> writes:

> It is included in NonGNU ELPA?
>
> https://git.savannah.gnu.org/cgit/emacs/nongnu.git/tree/elpa-packages#n410

Oh, okay.  I misread what John wrote.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#66466: [PATCH] Support lua-ts-mode in align.el
  2023-10-14  2:19     ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-10-21 10:27       ` Stefan Kangas
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Kangas @ 2023-10-21 10:27 UTC (permalink / raw)
  To: john muhl, Eshel Yaron; +Cc: 66466-done

Version: 30.1

john muhl <jm@pub.pink> writes:

>> Also, I noticed that we already have several similar rules for aligning
>> assignments and comments in `align-rules-list`.  Do none of them work
>> for Lua?
>
> The toml-assignment rule works well enough. I added the Lua modes there
> now.
>
>> If so, I wonder what specifics of Lua's syntax make the existing rules
>> inapplicable.
>
> For comments I only see the open-comment and c++-comment rules.
> open-comment doesn’t match trailing line comments. Extending c++-comment
> in the obvious way (Lua uses "--" for comment start) causes trouble with
> c++ code like:
>
>   int x = 5; // declare
>   x--; // decrement
>
> Lua shares comment syntax with at least Ada, Haskell, SQL and VHDL so I
> changed the name of the rule to double-dash-comment and added the Lua
> modes there.

Thanks, installed on master.

[1: a838bcb23c6]: 2023-10-21 12:25:25 +0200
  Support lua-ts-mode in align.el
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=a838bcb23c60fe5bd29a1013a8c75796420ee461





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-10-21 10:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-11 16:57 bug#66466: [PATCH] Support lua-ts-mode in align.el john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-12  7:35 ` Stefan Kangas
2023-10-12  8:36   ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-12 11:20     ` Stefan Kangas
2023-10-14  2:19     ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-21 10:27       ` Stefan Kangas
2023-10-13  3:13   ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-15 14:25     ` Stefan Kangas
2023-10-15 14:59       ` Philip Kaludercic
2023-10-15 15:18         ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).