Skip to content

Remove haskell-indentation-parse-error, fixup #1001

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 26, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions haskell-indentation.el
Original file line number Diff line number Diff line change
Expand Up @@ -200,19 +200,19 @@ negative ARG. Handles bird style literate Haskell too."
(if (haskell-indentation-bird-outside-code-p)
(progn
(delete-horizontal-space)
(newline))
(catch 'parse-error
;; - save the current column
(let* ((ci (haskell-indentation-current-indentation))
(indentations (haskell-indentation-find-indentations)))
;; - jump to the next line and reindent to at the least same level
(delete-horizontal-space)
(newline)
(when (haskell-indentation-bird-p)
(insert "> "))
(haskell-indentation-reindent-to
(haskell-indentation-next-indentation (- ci 1) indentations 'nofail)
'move)))))
(newline))
;; - save the current column
(let* ((ci (haskell-indentation-current-indentation))
(indentations (or (haskell-indentation-find-indentations)
'(0))))
;; - jump to the next line and reindent to at the least same level
(delete-horizontal-space)
(newline)
(when (haskell-indentation-bird-p)
(insert "> "))
(haskell-indentation-reindent-to
(haskell-indentation-next-indentation (- ci 1) indentations 'nofail)
'move))))

(defun haskell-indentation-next-indentation (col indentations &optional nofail)
"Find the leftmost indentation which is greater than COL.
Expand Down Expand Up @@ -262,11 +262,11 @@ indentation points to the right, we switch going to the left."
(ci (haskell-indentation-current-indentation))
(inds (save-excursion
(move-to-column ci)
(haskell-indentation-find-indentations)))
(or (haskell-indentation-find-indentations)
'(0))))
(valid (memq ci inds))
(cursor-in-whitespace (< cc ci)))
(when (null inds)
(error "returned indentations empty, but no parse error"))

(if (and valid cursor-in-whitespace)
(move-to-column ci)
(haskell-indentation-reindent-to
Expand Down Expand Up @@ -341,7 +341,8 @@ indentation points to the right, we switch going to the left."
(ci (haskell-indentation-current-indentation))
(inds (save-excursion
(move-to-column ci)
(haskell-indentation-find-indentations)))
(or (haskell-indentation-find-indentations)
'(0))))
(cursor-in-whitespace (< cc ci))
(pi (haskell-indentation-previous-indentation ci inds)))
(if (null pi)
Expand Down