From b3523951c50ac987f2950d17ffd28dbe5464803c Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Fri, 25 Jun 2010 21:45:32 +0900 Subject: [PATCH] ask GHC for pretty printing to GHC instead of pretifying in Elisp. --- Check.hs | 5 ++++- elisp/ghc-flymake.el | 8 +------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Check.hs b/Check.hs index 053f58c..c65d090 100644 --- a/Check.hs +++ b/Check.hs @@ -91,4 +91,7 @@ style :: PprStyle style = mkUserStyle neverQualify AllTheWay showSDoc :: SDoc -> String -showSDoc d = Pretty.showDocWith OneLineMode (d style) +showSDoc d = map toNull . Pretty.showDocWith ZigZagMode $ d style + where + toNull '\n' = '\0' + toNull x = x diff --git a/elisp/ghc-flymake.el b/elisp/ghc-flymake.el index 31951e5..403c75c 100644 --- a/elisp/ghc-flymake.el +++ b/elisp/ghc-flymake.el @@ -70,13 +70,7 @@ (defun ghc-flymake-insert-errors (title errs) (save-excursion (insert title "\n\n") - (mapc (lambda (x) (insert (ghc-replace-character x ghc-null ghc-newline) "\n")) errs) - (goto-char (point-min)) - (while (re-search-forward "In the definition of [^:\n ]+: \\|In the [^:\n ]+: \\|Expected type: \\|Inferred type: \\|Possible fix: " nil t) - (replace-match (concat "\n" (match-string 0) "\n "))) - (goto-char (point-max)) - (while (re-search-backward "In the [a-z]+ argument\\|In the `" nil t) - (insert "\n")))) + (mapc (lambda (x) (insert (ghc-replace-character x ghc-null ghc-newline) "\n")) errs))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;