Skip to content

Commit a7c953b

Browse files
committed
fix #42, wrong indentation in continual lines
Other conditions like comments, open blocks should be checked first
1 parent db257db commit a7c953b

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

fish-mode.el

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -521,11 +521,6 @@ POSITIVE-RE and NEGATIVE-RE are regular expressions."
521521
(forward-line -1)
522522

523523
(cond
524-
((line-continued-p)
525-
;; Return indentation of previous non-continued line.
526-
(back-to-non-continued)
527-
(throw :indent (current-indentation)))
528-
529524
((fish/at-empty-line?)
530525
;; Return indentation of previous non-continued line.
531526
(back-to-non-continued)
@@ -554,6 +549,11 @@ POSITIVE-RE and NEGATIVE-RE are regular expressions."
554549
((fish/at-open-end?)
555550
(throw :indent (- (current-indentation) fish-indent-offset)))
556551

552+
((line-continued-p)
553+
;; Return indentation of previous non-continued line.
554+
(back-to-non-continued)
555+
(throw :indent (current-indentation)))
556+
557557
(t
558558
;; Return current indentation.
559559
(throw :indent (current-indentation)))))))))

test-syntax.fish

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ function print_status
125125
foo \
126126
bar \
127127
baz \
128-
quux
128+
quux \
129+
while true
130+
foo
131+
end
129132
end
130133

131134
find . \

0 commit comments

Comments
 (0)