Adds ghc-report-errors to turn off *GHC Error* buffer when nil

ghc-mod now writes GHC errors to a new *GHC Error* buffer only if
report-ghc-errors has the value `t`. If a user wants to silence this
buffer, they should evaluate the following s-expression.

    (setq ghc-report-errors nil)

Fixes kazu-yamamoto/ghc-mod#618
This commit is contained in:
Rob Stewart 2015-10-10 22:47:04 +01:00
parent 2e09ed295c
commit 138c711dc1

View File

@ -27,6 +27,7 @@
(defvar ghc-command "ghc-mod")
(defvar ghc-report-errors t "Report GHC errors to *GHC Error* buffer")
(defvar ghc-error-buffer "*GHC Error*")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -144,6 +145,7 @@
(with-current-buffer pbuf
(goto-char (point-max))
(insert-buffer-substring tbuf 1 end))
(when ghc-report-errors
(with-current-buffer (get-buffer-create ghc-error-buffer)
(setq buffer-read-only t)
(let* ((buffer-read-only nil)
@ -156,7 +158,7 @@
(goto-char (point-max))
(insert-buffer-substring tbuf 1 end)
(set-buffer-modified-p nil))
(redisplay))))
(redisplay)))))
(delete-region 1 end)))))
(goto-char (point-max))
(forward-line -1)