|
49 | 49 | :group 'haskell
|
50 | 50 | :prefix "haskell-indentation-")
|
51 | 51 |
|
52 |
| -(defcustom haskell-indentation-indent-leftmost t |
53 |
| - "Indent to the left margin after certain keywords. |
54 |
| -For example after \"let .. in\", \"case .. of\"). If set to t it |
55 |
| -will only indent to the left. If nil only relative to the |
56 |
| -containing expression. If set to the symbol 'both then both |
57 |
| -positions are allowed." |
58 |
| - :type 'symbol |
59 |
| - :group 'haskell-indentation) |
60 |
| - |
61 | 52 | (defcustom haskell-indentation-layout-offset 2
|
62 | 53 | "Extra indentation to add before expressions in a Haskell layout list."
|
63 | 54 | :type 'integer
|
@@ -995,41 +986,14 @@ layout starts."
|
995 | 986 | (t (throw 'parse-end nil))))
|
996 | 987 | ((null (cdr phrase)))
|
997 | 988 | ((equal (cadr phrase) current-token)
|
998 |
| - (let* ((on-new-line (= (current-column) |
999 |
| - (haskell-indentation-current-indentation))) |
1000 |
| - (lines-between (- parse-line-number starter-line)) |
1001 |
| - (left-indent (if (<= lines-between 0) |
1002 |
| - left-indent |
1003 |
| - starter-indent))) |
1004 |
| - (haskell-indentation-read-next-token) |
1005 |
| - (when (eq current-token 'end-tokens) |
1006 |
| - (cond ((member (cadr phrase) '("then" "else")) |
1007 |
| - (haskell-indentation-add-indentation |
1008 |
| - (+ starter-indent haskell-indentation-ifte-offset))) |
1009 |
| - |
1010 |
| - ((member (cadr phrase) '("in" "->")) |
1011 |
| - ;; expression ending in another expression |
1012 |
| - (when (or (not haskell-indentation-indent-leftmost) |
1013 |
| - (eq haskell-indentation-indent-leftmost 'both)) |
1014 |
| - (haskell-indentation-add-indentation |
1015 |
| - (+ starter-indent haskell-indentation-starter-offset))) |
1016 |
| - (when haskell-indentation-indent-leftmost |
1017 |
| - (haskell-indentation-add-indentation |
1018 |
| - (if on-new-line |
1019 |
| - (+ left-indent haskell-indentation-starter-offset) |
1020 |
| - left-indent)))) |
1021 |
| - (t |
1022 |
| - (when (or (not haskell-indentation-indent-leftmost) |
1023 |
| - (eq haskell-indentation-indent-leftmost 'both)) |
1024 |
| - (haskell-indentation-add-indentation |
1025 |
| - (+ starter-indent haskell-indentation-starter-offset))) |
1026 |
| - (when haskell-indentation-indent-leftmost |
1027 |
| - (haskell-indentation-add-indentation |
1028 |
| - (if on-new-line |
1029 |
| - (+ left-indent haskell-indentation-starter-offset) |
1030 |
| - left-indent))))) |
1031 |
| - (throw 'parse-end nil)) |
1032 |
| - (setq phrase1 (cddr phrase)))) |
| 989 | + (haskell-indentation-read-next-token) |
| 990 | + (when (eq current-token 'end-tokens) |
| 991 | + (haskell-indentation-add-indentation |
| 992 | + (+ starter-indent haskell-indentation-starter-offset)) |
| 993 | + (haskell-indentation-add-indentation |
| 994 | + (+ left-indent haskell-indentation-starter-offset)) |
| 995 | + (throw 'parse-end nil)) |
| 996 | + (setq phrase1 (cddr phrase))) |
1033 | 997 | ((string= (cadr phrase) "in"))))))
|
1034 | 998 |
|
1035 | 999 | (defun haskell-indentation-add-indentation (indent)
|
|
0 commit comments