Skip to content

Commit d2b086a

Browse files
committed
Remove haskell-indentation-parse-error, fixup
1 parent 4a15fb3 commit d2b086a

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

haskell-indentation.el

+18-17
Original file line numberDiff line numberDiff line change
@@ -200,19 +200,19 @@ negative ARG. Handles bird style literate Haskell too."
200200
(if (haskell-indentation-bird-outside-code-p)
201201
(progn
202202
(delete-horizontal-space)
203-
(newline))
204-
(catch 'parse-error
205-
;; - save the current column
206-
(let* ((ci (haskell-indentation-current-indentation))
207-
(indentations (haskell-indentation-find-indentations)))
208-
;; - jump to the next line and reindent to at the least same level
209-
(delete-horizontal-space)
210-
(newline)
211-
(when (haskell-indentation-bird-p)
212-
(insert "> "))
213-
(haskell-indentation-reindent-to
214-
(haskell-indentation-next-indentation (- ci 1) indentations 'nofail)
215-
'move)))))
203+
(newline))
204+
;; - save the current column
205+
(let* ((ci (haskell-indentation-current-indentation))
206+
(indentations (or (haskell-indentation-find-indentations)
207+
'(0))))
208+
;; - jump to the next line and reindent to at the least same level
209+
(delete-horizontal-space)
210+
(newline)
211+
(when (haskell-indentation-bird-p)
212+
(insert "> "))
213+
(haskell-indentation-reindent-to
214+
(haskell-indentation-next-indentation (- ci 1) indentations 'nofail)
215+
'move))))
216216

217217
(defun haskell-indentation-next-indentation (col indentations &optional nofail)
218218
"Find the leftmost indentation which is greater than COL.
@@ -262,11 +262,11 @@ indentation points to the right, we switch going to the left."
262262
(ci (haskell-indentation-current-indentation))
263263
(inds (save-excursion
264264
(move-to-column ci)
265-
(haskell-indentation-find-indentations)))
265+
(or (haskell-indentation-find-indentations)
266+
'(0))))
266267
(valid (memq ci inds))
267268
(cursor-in-whitespace (< cc ci)))
268-
(when (null inds)
269-
(error "returned indentations empty, but no parse error"))
269+
270270
(if (and valid cursor-in-whitespace)
271271
(move-to-column ci)
272272
(haskell-indentation-reindent-to
@@ -341,7 +341,8 @@ indentation points to the right, we switch going to the left."
341341
(ci (haskell-indentation-current-indentation))
342342
(inds (save-excursion
343343
(move-to-column ci)
344-
(haskell-indentation-find-indentations)))
344+
(or (haskell-indentation-find-indentations)
345+
'(0))))
345346
(cursor-in-whitespace (< cc ci))
346347
(pi (haskell-indentation-previous-indentation ci inds)))
347348
(if (null pi)

0 commit comments

Comments
 (0)