Skip to content

Commit a147438

Browse files
committed
Treat blank lines with a bunch of whitespace as a ;.
1 parent d1266f8 commit a147438

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

elixir-smie.el

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,21 @@
112112
;; The point here is that we want to treat blank lines as a single semi-
113113
;; colon when it comes to detecting the end of match statements. This could
114114
;; also be handled by a `while' expression or some other looping mechanism.
115-
(if (and (eolp) (bolp))
116-
(progn (forward-char)
117-
(if (< (point) (point-max))
118-
(elixir-smie--semi-ends-match)
119-
nil))
120-
;; And if we're NOT on a blank line, move to the end of the line, and see
121-
;; if we're looking back at a block operator.
122-
(progn (move-end-of-line 1)
123-
(looking-back elixir-smie--block-operator-regexp)))))
115+
(cond
116+
((and (eolp) (bolp))
117+
(forward-char)
118+
(if (< (point) (point-max))
119+
(elixir-smie--semi-ends-match)
120+
nil))
121+
((looking-at elixir-smie--spaces-til-eol-regexp)
122+
(move-beginning-of-line 2)
123+
(if (< (point) (point-max))
124+
(elixir-smie--semi-ends-match)
125+
nil))
126+
;; And if we're NOT on a blank line, move to the end of the line, and see
127+
;; if we're looking back at a block operator.
128+
(t (move-end-of-line 1)
129+
(looking-back elixir-smie--block-operator-regexp)))))
124130

125131
(defun elixir-smie--same-line-as-parent (parent-pos child-pos)
126132
"Return non-nil if `child-pos' is on same line as `parent-pos'."

0 commit comments

Comments
 (0)