Use temporary buffer for ghc-display

Instead of opening a normal editable buffer (in which editing text does
not make a lot of sense), use Emacs's temporary buffer. Benefits:

   - Read only: Text cannot be modified when focused.
   - Much easier to close (press q), after reading or copying from the
     warning/error.

Signed-off-by: Rohan Jain <crodjer@gmail.com>
This commit is contained in:
Rohan Jain 2014-04-06 21:50:38 +05:30 committed by Kazu Yamamoto
parent cc519edc98
commit a21178d2af

View File

@ -147,7 +147,8 @@
(defconst ghc-error-buffer-name "*GHC Info*")
(defun ghc-display (fontify ins-func)
(let ((buf (get-buffer-create ghc-error-buffer-name)))
(let ((buf ghc-error-buffer-name))
(with-output-to-temp-buffer buf
(with-current-buffer buf
(erase-buffer)
(funcall ins-func)
@ -157,7 +158,7 @@
(turn-off-haskell-font-lock)
(haskell-font-lock-defaults-create)
(turn-on-haskell-font-lock)))
(display-buffer buf)))
(display-buffer buf))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;