Skip to content

Avoid indentation errors after 'end'. #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions elixir-smie.el
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,12 @@ Return non-nil if any line breaks were skipped."
(block elixir-smie-next-token-no-lookaround
;; First, skip comments; but if any comments / newlines were
;; skipped, the upper level needs to check if they were significant:
(when (if forwardp

(when
(if forwardp
(elixir-skip-comment-forward)
(elixir-skip-comment-backward))
(return-from elixir-smie-next-token-no-lookaround "\n"))
(return-from elixir-smie-next-token-no-lookaround "\n"))
(let* ((found-token-class (find-if
(lambda (class-def)
(let ((regex (symbol-value (car class-def))))
Expand Down Expand Up @@ -292,6 +294,12 @@ Return non-nil if any line breaks were skipped."
elixir-smie-indent-basic))
(`(,_ . ,(or `"COMMA")) (smie-rule-separator kind))
(`(:after . "=") elixir-smie-indent-basic)
(`(:after . "end")
;; dont't increase the indent level after an 'end' was seen.
;; FIXME: This is just a woraround to do the right thing under
;; normal circumstances Once the problem with newline assessment
;; is (#5 and #18 !?) fixed, this should be unnecessary
0)
(`(:after . ,(or `"do"))
elixir-smie-indent-basic)
(`(:list-intro . ,(or `"do"))
Expand Down