Skip to content

Commit 67751d8

Browse files
committed
Refactor for conciseness.
1 parent a147438 commit 67751d8

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

elixir-smie.el

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -112,21 +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-
(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)))))
115+
(flet ((self-call ()
116+
(if (< (point) (point-max))
117+
(elixir-smie--semi-ends-match)
118+
nil)))
119+
(cond
120+
((and (eolp) (bolp))
121+
(forward-char)
122+
(self-call))
123+
((looking-at elixir-smie--spaces-til-eol-regexp)
124+
(move-beginning-of-line 2)
125+
(self-call))
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))))))
130130

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

0 commit comments

Comments
 (0)