|
1 | 1 | ;;; elixir-smie.el --- Structural syntax support for elixir-mode |
2 | 2 |
|
3 | | -;; Copyright 2011-2014 secondplanet |
4 | | -;; 2013-2014 Samuel Tonini, Matt DeBoard, Andreas Fuchs |
| 3 | +;; Copyright 2011-2015 secondplanet |
| 4 | +;; 2013-2015 Samuel Tonini, Matt DeBoard, Andreas Fuchs |
5 | 5 |
|
6 | 6 | ;; This file is not a part of GNU Emacs. |
7 | 7 |
|
|
142 | 142 |
|
143 | 143 | (defvar elixir-smie--operator-regexp |
144 | 144 | (rx (or "<<<" ">>>" "^^^" "~~~" "&&&" "|||" "===" "!==" "==" "!=" "<=" |
145 | | - "=" ">=" "<" ">" "&&" "||" "<>" "++" "--" "//" "/>" "=~" "|>"))) |
| 145 | + "=" ">=" "<" ">" "&&" "||" "<>" "++" "--" "//" "/>" "=~" "|>"))) |
146 | 146 |
|
147 | 147 | (defvar elixir-smie--binary-sequence-regexp |
148 | 148 | (rx (or "<<" ">>"))) |
|
186 | 186 | ;; colon when it comes to detecting the end of match statements. This could |
187 | 187 | ;; also be handled by a `while' expression or some other looping mechanism. |
188 | 188 | (cl-flet ((self-call () |
189 | | - (if (< (point) (point-max)) |
190 | | - (elixir-smie--semi-ends-match) |
191 | | - nil))) |
192 | | - (cond |
193 | | - ((and (eolp) (bolp)) |
194 | | - (forward-char) |
195 | | - (self-call)) |
196 | | - ((looking-at elixir-smie--spaces-til-eol-regexp) |
197 | | - (move-beginning-of-line 2) |
198 | | - (self-call)) |
199 | | - ;; And if we're NOT on a blank line, move to the end of the line, and see |
200 | | - ;; if we're looking back at a block operator. |
201 | | - (t (move-end-of-line 1) |
202 | | - (looking-back elixir-smie--block-operator-regexp))))))) |
| 189 | + (if (< (point) (point-max)) |
| 190 | + (elixir-smie--semi-ends-match) |
| 191 | + nil))) |
| 192 | + (cond |
| 193 | + ((and (eolp) (bolp)) |
| 194 | + (forward-char) |
| 195 | + (self-call)) |
| 196 | + ((looking-at elixir-smie--spaces-til-eol-regexp) |
| 197 | + (move-beginning-of-line 2) |
| 198 | + (self-call)) |
| 199 | + ;; And if we're NOT on a blank line, move to the end of the line, and see |
| 200 | + ;; if we're looking back at a block operator. |
| 201 | + (t (move-end-of-line 1) |
| 202 | + (looking-back elixir-smie--block-operator-regexp))))))) |
203 | 203 |
|
204 | 204 | (defun elixir-smie--same-line-as-parent (parent-pos child-pos) |
205 | 205 | "Return non-nil if `child-pos' is on same line as `parent-pos'." |
|
216 | 216 | (looking-at "[\n#]")) |
217 | 217 | (elixir-smie--implicit-semi-p)) |
218 | 218 | (when (not (save-excursion |
219 | | - (forward-comment 1) |
220 | | - (eobp))) |
| 219 | + (forward-comment 1) |
| 220 | + (eobp))) |
221 | 221 | (if (eolp) (forward-char 1) (forward-comment 1))) |
222 | 222 | ;; Note: `elixir-smie--semi-ends-match' will be called when the point is at |
223 | 223 | ;; the beginning of a new line. Keep that in mind. |
|
318 | 318 | (nth 1 smie--parent) |
319 | 319 | (point))) |
320 | 320 | (smie-rule-parent elixir-smie-indent-basic) |
321 | | - elixir-smie-indent-basic)) |
| 321 | + elixir-smie-indent-basic)) |
322 | 322 | ;; Otherwise, if just indent by two. |
323 | 323 | ((smie-rule-hanging-p) |
324 | 324 | (cond |
|
0 commit comments