* bug#63109: 30.0.50; [PATCH] Add bitstring indentation and navigation for elixir-ts-mode
@ 2023-04-27 9:52 Wilhelm Kirschbaum
2023-04-29 9:15 ` Eli Zaretskii
0 siblings, 1 reply; 2+ messages in thread
From: Wilhelm Kirschbaum @ 2023-04-27 9:52 UTC (permalink / raw)
To: 63109
[-- Attachment #1: Type: text/plain, Size: 78 bytes --]
This patch properly handles bitstrings in Elixir when using
elixir-ts-mode.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Add bitstring indentation and navigation for elixir-ts-mode --]
[-- Type: text/x-patch, Size: 2538 bytes --]
From d84228a3b482b064aa0f0e915562d950cc45ef0d Mon Sep 17 00:00:00 2001
From: Wilhelm H Kirschbaum <wkirschbaum@gmail.com>
Date: Thu, 27 Apr 2023 11:39:39 +0200
Subject: [PATCH] Add bitstring indentation and navigation for elixir-ts-mode
* lisp/progmodes/elixir-ts-mode.el
(elixir-ts--sexp-regexp): Add bistring.
(elixir-ts--indent-rules): Handle bitstring indentation.
* test/lisp/progmodes/elixir-ts-mode-resources/indent.erts:
Add test case.
---
lisp/progmodes/elixir-ts-mode.el | 4 +++-
.../progmodes/elixir-ts-mode-resources/indent.erts | 12 ++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/lisp/progmodes/elixir-ts-mode.el b/lisp/progmodes/elixir-ts-mode.el
index c58854c41c3..47f53043af3 100644
--- a/lisp/progmodes/elixir-ts-mode.el
+++ b/lisp/progmodes/elixir-ts-mode.el
@@ -89,7 +89,7 @@ elixir-ts--sexp-regexp
(rx bol
(or "call" "stab_clause" "binary_operator" "list" "tuple" "map" "pair"
"sigil" "string" "atom" "alias" "arguments" "identifier"
- "boolean" "quoted_content")
+ "boolean" "quoted_content" "bitstring")
eol))
(defconst elixir-ts--test-definition-keywords
@@ -231,6 +231,7 @@ elixir-ts--indent-rules
((node-is "^]$") ,'elixir-ts--parent-expression-start 0)
((node-is "^}$") ,'elixir-ts--parent-expression-start 0)
((node-is "^)$") ,'elixir-ts--parent-expression-start 0)
+ ((node-is "^>>$") ,'elixir-ts--parent-expression-start 0)
((node-is "^else_block$") grand-parent 0)
((node-is "^catch_block$") grand-parent 0)
((node-is "^rescue_block$") grand-parent 0)
@@ -250,6 +251,7 @@ elixir-ts--indent-rules
,'elixir-ts--argument-indent-anchor
,'elixir-ts--argument-indent-offset)
((parent-is "^pair$") parent ,offset)
+ ((parent-is "^bitstring$") parent ,offset)
((parent-is "^map_content$") parent-bol 0)
((parent-is "^map$") ,'elixir-ts--parent-expression-start ,offset)
((node-is "^stab_clause$") parent-bol ,offset)
diff --git a/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts b/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts
index 9ad604e5198..4eb6e768b96 100644
--- a/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts
+++ b/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts
@@ -79,6 +79,18 @@ def foo() do
end
=-=-=
+Name: Bitstring mulitline
+
+=-=
+<<12, 22,
+22, 32
+ >>
+=-=
+<<12, 22,
+ 22, 32
+>>
+=-=-=
+
Name: Block assignments
=-=
--
2.40.1
[-- Attachment #3: Type: text/plain, Size: 9 bytes --]
Wilhelm
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#63109: 30.0.50; [PATCH] Add bitstring indentation and navigation for elixir-ts-mode
2023-04-27 9:52 bug#63109: 30.0.50; [PATCH] Add bitstring indentation and navigation for elixir-ts-mode Wilhelm Kirschbaum
@ 2023-04-29 9:15 ` Eli Zaretskii
0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2023-04-29 9:15 UTC (permalink / raw)
To: Wilhelm Kirschbaum; +Cc: 63109-done
> From: Wilhelm Kirschbaum <wkirschbaum@gmail.com>
> Date: Thu, 27 Apr 2023 11:52:28 +0200
>
> This patch properly handles bitstrings in Elixir when using
> elixir-ts-mode.
Thanks, installed and closing the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-04-29 9:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-27 9:52 bug#63109: 30.0.50; [PATCH] Add bitstring indentation and navigation for elixir-ts-mode Wilhelm Kirschbaum
2023-04-29 9:15 ` Eli Zaretskii
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).