Skip to content

Commit

Permalink
Support continuations in the process loading
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdone committed Mar 8, 2014
1 parent 6bec474 commit 5ce988e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions haskell-process.el
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ for various things, but is optional."
(interactive)
(haskell-process-do-cabal
(funcall haskell-completing-read-function "Cabal command: "
haskell-cabal-commands)))
haskell-cabal-commands)))

(defun haskell-process-add-cabal-autogen ()
"Add <cabal-project-dir>/dist/build/autogen/ to the ghci search
Expand Down Expand Up @@ -521,7 +521,7 @@ to be loaded by ghci."
(setf (cdddr state) (list (length buffer)))
nil)

(defun haskell-process-load-complete (session process buffer reload module-buffer)
(defun haskell-process-load-complete (session process buffer reload module-buffer &optional cont)
"Handle the complete loading response. BUFFER is the string of
text being sent over the process pipe. MODULE-BUFFER is the
actual Emacs buffer of the module being loaded."
Expand All @@ -538,7 +538,9 @@ actual Emacs buffer of the module being loaded."
(haskell-process-reload-with-fbytecode process module-buffer)
(haskell-process-import-modules process (car modules)))
(haskell-mode-message-line
(if reload "Reloaded OK." "OK.")))))
(if reload "Reloaded OK." "OK."))
(when cont
(funcall cont t)))))
((haskell-process-consume process "Failed, modules loaded: \\(.+\\)\\.$")
(let* ((modules (haskell-process-extract-modules buffer))
(cursor (haskell-process-response-cursor process))
Expand All @@ -549,7 +551,9 @@ actual Emacs buffer of the module being loaded."
(if (and (not reload) haskell-process-reload-with-fbytecode)
(haskell-process-reload-with-fbytecode process module-buffer)
(haskell-process-import-modules process (car modules)))
(haskell-interactive-mode-compile-error session "Compilation failed.")))))
(haskell-interactive-mode-compile-error session "Compilation failed.")
(when cont
(funcall cont nil))))))

(defun haskell-process-reload-with-fbytecode (process module-buffer)
"Reload FILE-NAME with -fbyte-code set, and then restore -fobject-code."
Expand Down

0 comments on commit 5ce988e

Please sign in to comment.