From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: 66466@debbugs.gnu.org, john muhl <jm@pub.pink>
Subject: bug#66466: [PATCH] Support lua-ts-mode in align.el
Date: Thu, 12 Oct 2023 10:36:23 +0200 [thread overview]
Message-ID: <m1zg0ogrug.fsf@sp-byods-145-109-45-251.wireless.uva.nl> (raw)
In-Reply-To: <CADwFkmmNjtTt8_FLQACX+djF5E29NjA=Vag2KX9izXgqnCmpJQ@mail.gmail.com> (Stefan Kangas's message of "Thu, 12 Oct 2023 07:35:36 +0000")
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
next prev parent reply other threads:[~2023-10-12 8:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1zg0ogrug.fsf@sp-byods-145-109-45-251.wireless.uva.nl \
--to=bug-gnu-emacs@gnu.org \
--cc=66466@debbugs.gnu.org \
--cc=jm@pub.pink \
--cc=me@eshelyaron.com \
--cc=stefankangas@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).