Skip to content

Commit

Permalink
fix #42, wrong indentation in continual lines
Browse files Browse the repository at this point in the history
Other conditions like comments, open blocks should be checked first
  • Loading branch information
wwwjfy committed Feb 15, 2021
1 parent db257db commit a7c953b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 5 additions & 5 deletions fish-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -521,11 +521,6 @@ POSITIVE-RE and NEGATIVE-RE are regular expressions."
(forward-line -1)

(cond
((line-continued-p)
;; Return indentation of previous non-continued line.
(back-to-non-continued)
(throw :indent (current-indentation)))

((fish/at-empty-line?)
;; Return indentation of previous non-continued line.
(back-to-non-continued)
Expand Down Expand Up @@ -554,6 +549,11 @@ POSITIVE-RE and NEGATIVE-RE are regular expressions."
((fish/at-open-end?)
(throw :indent (- (current-indentation) fish-indent-offset)))

((line-continued-p)
;; Return indentation of previous non-continued line.
(back-to-non-continued)
(throw :indent (current-indentation)))

(t
;; Return current indentation.
(throw :indent (current-indentation)))))))))
Expand Down
5 changes: 4 additions & 1 deletion test-syntax.fish
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ function print_status
foo \
bar \
baz \
quux
quux \
while true
foo
end
end

find . \
Expand Down

0 comments on commit a7c953b

Please sign in to comment.