Skip to content

Commit d14291d

Browse files
committed
Emit '->' directly at start of match stmt.
1 parent 1a66063 commit d14291d

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

elixir-smie.el

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,11 @@
102102
"Return non-nil if the current line concludes a match block."
103103
(save-excursion
104104
(forward-char)
105-
(if (eolp) nil
105+
(if (eolp)
106+
nil
106107
(progn (move-end-of-line 1)
107-
(looking-back elixir-smie--operator-regexp)))))
108+
(looking-back elixir-smie--block-operator-regexp
109+
(- (point) 2) t)))))
108110

109111
(defun elixir-smie-forward-token ()
110112
(cond
@@ -120,7 +122,7 @@
120122
";"))
121123
((looking-at elixir-smie--block-operator-regexp)
122124
(goto-char (match-end 0))
123-
"MATCH-STATEMENT-DELIMITER")
125+
"->")
124126
((looking-at elixir-smie--operator-regexp)
125127
(goto-char (match-end 0))
126128
"OP")
@@ -137,7 +139,7 @@
137139
";"))
138140
((looking-back elixir-smie--block-operator-regexp (- (point) 3) t)
139141
(goto-char (match-beginning 0))
140-
"MATCH-STATEMENT-DELIMITER")
142+
"->")
141143
((looking-back elixir-smie--operator-regexp (- (point) 3) t)
142144
(goto-char (match-beginning 0))
143145
"OP")
@@ -165,10 +167,10 @@
165167
(cond
166168
((and (not (smie-rule-sibling-p))
167169
(smie-rule-hanging-p))
168-
(smie-rule-parent elixir-smie-indent-basic))
169-
((and (smie-rule-hanging-p)
170-
(smie-rule-sibling-p))
171-
(smie-rule-parent))))
170+
(smie-rule-parent elixir-smie-indent-basic))))
171+
;; ((and (smie-rule-hanging-p)
172+
;; (smie-rule-sibling-p))
173+
;; (smie-rule-parent))))
172174

173175
(`(:after . "MATCH-STATEMENT-DELIMITER")
174176
(cond
@@ -179,6 +181,11 @@
179181
(smie-rule-hanging-p))
180182
(smie-rule-parent elixir-smie-indent-basic))))
181183

184+
(`(:before . "->")
185+
(cond
186+
((smie-rule-hanging-p)
187+
(smie-rule-parent elixir-smie-indent-basic))))
188+
182189
(`(:before . ";")
183190
(cond
184191
((smie-rule-parent-p "after" "catch" "def" "defmodule" "defp" "do" "else"

0 commit comments

Comments
 (0)