Skip to content

Commit d1266f8

Browse files
committed
Fix bug in match-ending detection fn.
1 parent a426d8e commit d1266f8

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

elixir-smie.el

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,24 @@
101101
(defun elixir-smie--semi-ends-match ()
102102
"Return non-nil if the current line concludes a match block."
103103
(save-excursion
104-
(if (eolp)
105-
nil
104+
;; Warning: Recursion.
105+
;; This is easy though.
106+
107+
;; 1. If we're at a blank line, move forward a character. This takes us to
108+
;; the next line.
109+
;; 2. If we're not at the end of the buffer, call this function again.
110+
;; (Otherwise, return nil.)
111+
112+
;; The point here is that we want to treat blank lines as a single semi-
113+
;; colon when it comes to detecting the end of match statements. This could
114+
;; 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.
106122
(progn (move-end-of-line 1)
107123
(looking-back elixir-smie--block-operator-regexp)))))
108124

0 commit comments

Comments
 (0)