Skip to content
Merged
Show file tree
Hide file tree
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
22 changes: 15 additions & 7 deletions elixir-smie.el
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,15 @@
((looking-at elixir-smie--operator-regexp)
(goto-char (match-end 0))
"OP")
(t
(let ((token (smie-default-forward-token)))
(unless (elixir-smie-empty-string-p token)
token)))))
(t (let ((token (smie-default-forward-token)))
(unless (or (elixir-smie-empty-string-p token)
(elixir-smie--at-dot-call))
token)))))

(defun elixir-smie--at-dot-call ()
(and (eq ?w (char-syntax (following-char)))
(eq (char-before) ?.)
(not (eq (char-before (1- (point))) ?.))))

(defun elixir-smie-backward-token ()
(let ((pos (point)))
Expand All @@ -303,7 +308,10 @@
((looking-back elixir-smie--operator-regexp (- (point) 3) t)
(goto-char (match-beginning 0))
"OP")
(t (smie-default-backward-token)))))
(t (let ((token (smie-default-backward-token)))
(unless (or (elixir-smie-empty-string-p token)
(elixir-smie--at-dot-call))
token))))))

(defun verbose-elixir-smie-rules (kind token)
(let ((value (elixir-smie-rules kind token)))
Expand Down Expand Up @@ -574,7 +582,7 @@
;; ...
((and (not (smie-rule-hanging-p))
(smie-rule-parent-p "do"))
elixir-smie-indent-basic)
elixir-smie-indent-basic)
((and (not (smie-rule-hanging-p))
(smie-rule-parent-p "MATCH-STATEMENT-DELIMITER"))
(smie-rule-parent))
Expand Down Expand Up @@ -707,7 +715,7 @@
(let ((pos (point)))
(parse-partial-sexp 1 pos)))))
(and (looking-at "\"\"\"")
(match-beginning 0)))))
(match-beginning 0)))))

(defun elixir-smie--previous-line-empty-p ()
"Return non-nil if the previous line is blank."
Expand Down
6 changes: 2 additions & 4 deletions test/elixir-mode-indentation-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,7 @@ else: :bar"
)

(elixir-def-indentation-test indent-if-when-condition-is-a-named-function-on-a-module
(:expected-result :failed :tags '(indentation))
;; https://github.com/elixir-lang/emacs-elixir/issues/323
(:tags '(indentation))
"defmodule Whois do
def lookup2(domain) do
if Server.for(domain) do
Expand Down Expand Up @@ -1575,8 +1574,7 @@ end"
end")

(elixir-def-indentation-test indent-case-when-condition-is-a-named-function-on-a-module
(:expected-result :failed :tags '(indentation))
;; https://github.com/elixir-lang/emacs-elixir/issues/323
(:tags '(indentation))
"defmodule Whois do
def lookup1(domain) do
case Server.for(domain) do
Expand Down