Skip to content

Commit 709903a

Browse files
committed
Merge pull request #966 from gracjan/pr-remove-safety-hack
Remove indentation safety hack
2 parents 6487f75 + 849ced5 commit 709903a

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

haskell-indentation.el

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ negative ARG. Handles bird style literate Haskell too."
210210
(catch 'parse-error
211211
;; - save the current column
212212
(let* ((ci (haskell-indentation-current-indentation))
213-
(indentations (haskell-indentation-find-indentations-safe)))
213+
(indentations (haskell-indentation-find-indentations)))
214214
;; - jump to the next line and reindent to at the least same level
215215
(delete-horizontal-space)
216216
(newline)
@@ -261,20 +261,18 @@ indentation points to the right, we switch going to the left."
261261
(unless (save-excursion
262262
(beginning-of-line)
263263
(nth 8 (syntax-ppss)))
264-
;; parse error is intentionally not catched here, it may come from
265-
;; `haskell-indentation-find-indentations-safe', but escapes the scope
264+
;; parse error is intentionally not cought here, it may come from
265+
;; `haskell-indentation-find-indentations', but escapes the scope
266266
;; and aborts the opertaion before any moving happens
267267
(let* ((cc (current-column))
268268
(ci (haskell-indentation-current-indentation))
269269
(inds (save-excursion
270270
(move-to-column ci)
271-
(haskell-indentation-find-indentations-safe)))
271+
(haskell-indentation-find-indentations)))
272272
(valid (memq ci inds))
273273
(cursor-in-whitespace (< cc ci)))
274-
;; can't happen right now, because of -safe, but we may want to have
275-
;; this in the future
276-
;; (when (null inds)
277-
;; (error "returned indentations empty, but no parse error"))
274+
(when (null inds)
275+
(error "returned indentations empty, but no parse error"))
278276
(if (and valid cursor-in-whitespace)
279277
(move-to-column ci)
280278
(haskell-indentation-reindent-to
@@ -349,7 +347,7 @@ indentation points to the right, we switch going to the left."
349347
(ci (haskell-indentation-current-indentation))
350348
(inds (save-excursion
351349
(move-to-column ci)
352-
(haskell-indentation-find-indentations-safe)))
350+
(haskell-indentation-find-indentations)))
353351
(cursor-in-whitespace (< cc ci))
354352
(pi (haskell-indentation-previous-indentation ci inds)))
355353
(if (null pi)
@@ -485,11 +483,6 @@ indentation points to the right, we switch going to the left."
485483
(t
486484
(haskell-indentation-parse-to-indentations)))))
487485

488-
;; XXX: this is a hack, the parser shouldn't return nil without parse-error
489-
(defun haskell-indentation-find-indentations-safe ()
490-
(or (haskell-indentation-find-indentations)
491-
(haskell-indentation-first-indentation)))
492-
493486
(defconst haskell-indentation-unicode-tokens
494487
'(("" . "->") ;; #x2192 RIGHTWARDS ARROW
495488
("" . "::") ;; #x2237 PROPORTION

0 commit comments

Comments
 (0)