Subject: 30.0.50; [PATCH] Improve call indentation for elixir-ts-mode
From: Wilhelm Kirschbaum <[email-masked]>
To: [email-masked]
Date: Thu, 27 Apr 2023 12:29:58 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Improves indentation for call's when the first argument is on the 
same
line as the call itself.

From 3a03e1ba99d8d28b302f0130f07bed17ae2a0d06 Mon Sep 17 00:00:00 2001
From: Wilhelm H Kirschbaum <[email-masked]>
Date: Thu, 27 Apr 2023 12:13:25 +0200
Subject: [PATCH] Improve call indentation for elixir-ts-mode

* lisp/progmodes/elixir-ts-mode.el
(elixir-ts--indent-rules): Change match order.

* test/lisp/progmodes/elixir-ts-mode-resources/indent.erts:
Add test case.
---
 lisp/progmodes/elixir-ts-mode.el                   |  2 +-
 .../progmodes/elixir-ts-mode-resources/indent.erts | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/elixir-ts-mode.el b/lisp/progmodes/elixir-ts-mode.el
index 47f53043af3..7175fe4bff8 100644
--- a/lisp/progmodes/elixir-ts-mode.el
+++ b/lisp/progmodes/elixir-ts-mode.el
@@ -257,7 +257,6 @@ elixir-ts--indent-rules
        ((node-is "^stab_clause$") parent-bol ,offset)
        ((query ,elixir-ts--capture-operator-parent) grand-parent 0)
        ((node-is "^when$") parent 0)
-       ((node-is "^keywords$") parent-bol ,offset)
        ((parent-is "^body$")
         (lambda (node parent _)
           (save-excursion
@@ -272,6 +271,7 @@ elixir-ts--indent-rules
         ,'elixir-ts--argument-indent-anchor
         ,'elixir-ts--argument-indent-offset)
        ;; Handle incomplete maps when parent is ERROR.
+       ((node-is "^keywords$") parent-bol ,offset)
        ((n-p-gp "^binary_operator$" "ERROR" nil) parent-bol 0)
        ;; When there is an ERROR, just indent to prev-line.
        ((parent-is "ERROR") prev-line ,offset)
diff --git a/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts b/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts
index 4eb6e768b96..1f855d3c977 100644
--- a/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts
+++ b/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts
@@ -193,7 +193,19 @@ tuple = {
 }
 =-=-=
 
-Name: Spec and method
+Name: Call with keywords
+
+=-=
+def foo() do
+  bar(:one,
+      :two,
+      one: 1,
+      two: 2
+  )
+end
+=-=-=
+
+Name: Call with @spec
 
 =-=
 @spec foobar(
-- 
2.40.1