"="
(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:
"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))
--- /dev/null
+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
+}
+=-=-=
(ert-test-erts-file (ert-resource-file "latex-mode.erts")
(test-align-transform-fun #'latex-mode)))
+(ert-deftest align-lua ()
+ (skip-unless (treesit-ready-p '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)))