Skip to content

Commit

Permalink
Handle compile messages from GHC that contain [TH]
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdone committed Apr 30, 2014
1 parent 9324171 commit 254ba72
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 16 deletions.
16 changes: 9 additions & 7 deletions haskell-interactive-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -599,14 +599,16 @@ SESSION, otherwise operate on the current buffer.
"Get the interactive buffer of the session."
(haskell-session-interactive-buffer (haskell-session)))

(defun haskell-interactive-show-load-message (session type module-name file-name echo)
(defun haskell-interactive-show-load-message (session type module-name file-name echo th)
"Show the '(Compiling|Loading) X' message."
(let ((msg (ecase type
('compiling
(if haskell-interactive-mode-include-file-name
(format "Compiling: %s (%s)" module-name file-name)
(format "Compiling: %s" module-name)))
('loading (format "Loading: %s" module-name)))))
(let ((msg (concat
(ecase type
('compiling
(if haskell-interactive-mode-include-file-name
(format "Compiling: %s (%s)" module-name file-name)
(format "Compiling: %s" module-name)))
('loading (format "Loading: %s" module-name)))
(if th " [TH]" ""))))
(haskell-mode-message-line msg)
(when haskell-interactive-mode-delete-superseded-errors
(haskell-interactive-mode-delete-compile-messages session file-name))
Expand Down
30 changes: 21 additions & 9 deletions haskell-process.el
Original file line number Diff line number Diff line change
Expand Up @@ -637,15 +637,14 @@ from `module-buffer'."
(concat "\\[[ ]*\\([0-9]+\\) of \\([0-9]+\\)\\]"
" Compiling \\([^ ]+\\)[ ]+"
"( \\([^ ]+\\), \\([^ ]+\\) )[^\r\n]*[\r\n]+"))
(let ((session (haskell-process-session process))
(module-name (match-string 3 buffer))
(file-name (match-string 4 buffer)))
(haskell-interactive-show-load-message
session
'compiling
module-name
(haskell-session-strip-dir session file-name)
echo-in-repl))
(haskell-process-load-message process buffer echo-in-repl nil)
t)
((haskell-process-consume
process
(concat "\\[[ ]*\\([0-9]+\\) of \\([0-9]+\\)\\]"
" Compiling \\[TH\\] \\([^ ]+\\)[ ]+"
"( \\([^ ]+\\), \\([^ ]+\\) )[^\r\n]*[\r\n]+"))
(haskell-process-echo-load-message process buffer echo-in-repl t)
t)
((haskell-process-consume process "Loading package \\([^ ]+\\) ... linking ... done.\n")
(haskell-mode-message-line
Expand All @@ -671,6 +670,19 @@ from `module-buffer'."
msg)
(haskell-mode-message-line msg)))))

(defun haskell-process-echo-load-message (process buffer echo-in-repl th)
"Echo a load message."
(let ((session (haskell-process-session process))
(module-name (match-string 3 buffer))
(file-name (match-string 4 buffer)))
(haskell-interactive-show-load-message
session
'compiling
module-name
(haskell-session-strip-dir session file-name)
echo-in-repl
th)))

(defun haskell-process-errors-warnings (session process buffer)
"Trigger handling type errors or warnings."
(cond
Expand Down

0 comments on commit 254ba72

Please sign in to comment.