Skip to content

Commit 1732076

Browse files
Handle mutually recursive definitions in phrase detection
Refs #171
1 parent 6fc1dcd commit 1732076

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

fsharp-mode-indent.el

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -913,11 +913,11 @@ NOMARK is not nil."
913913
(found nil)
914914
initial-indent)
915915
(fsharp-goto-initial-line)
916-
;; if on blank or non-indenting comment line, use the preceding stmt
917-
(if (looking-at "[ \t]*\\($\\|//[^ \t\n]\\)")
918-
(progn
919-
(fsharp-goto-statement-at-or-above)
920-
(setq found (fsharp-statement-opens-block-p))))
916+
;; if on and (mutually recursive bindings), blank or non-indenting comment line, use the preceding stmt
917+
(when (or (looking-at "[ \t]*\\($\\|//[^ \t\n]\\)")
918+
(looking-at-p "[ \t]*and[ \t]+"))
919+
(fsharp-goto-statement-at-or-above)
920+
(setq found (fsharp-statement-opens-block-p)))
921921
;; search back for colon line indented less
922922
(setq initial-indent (current-indentation))
923923
(if (zerop initial-indent)
@@ -1618,7 +1618,10 @@ This tells add-log.el how to find the current function/method/variable."
16181618
(forward-line -1))
16191619
(error
16201620
(progn (goto-char (point-max)))))
1621-
(end-of-line))
1621+
(end-of-line)
1622+
(when (looking-at-p "\n[ \t]*and[ \t]+")
1623+
(forward-line 1)
1624+
(fsharp-end-of-block)))
16221625
(goto-char (point-max))))
16231626

16241627
(provide 'fsharp-mode-indent)

0 commit comments

Comments
 (0)