Permalink
Browse files

Make haskell-process-restart work properly (refs #53).

  • Loading branch information...
1 parent c3a2cbf commit 5573a64398be50d05d93ff4e06163e1de1ff82a6 @chrisdone chrisdone committed Jun 1, 2012
Showing with 15 additions and 12 deletions.
  1. +15 −12 haskell-process.el
View
27 haskell-process.el
@@ -402,6 +402,10 @@
;;;###autoload
(defun haskell-process-start (session)
"Start the inferior Haskell process."
+ (let ((existing-process (get-process (haskell-session-name (haskell-session)))))
+ (when (processp existing-process)
+ (haskell-process-set (haskell-session-process session) 'is-restarting t)
+ (delete-process existing-process)))
(let ((process (haskell-process-make (haskell-session-name session))))
(haskell-session-set-process session process)
(haskell-process-set-session process session)
@@ -501,13 +505,8 @@
(haskell-command-make process
(lambda (process)
(haskell-process-send-string process ":set prompt \"> \"")
- (haskell-process-send-string process "Prelude.putStrLn \"\""))
- nil
- nil))
- (haskell-process-queue-command
- process
- (haskell-command-make process
- (lambda (process) (haskell-process-send-string process ":set -v1"))
+ (haskell-process-send-string process "Prelude.putStrLn \"\"")
+ (haskell-process-send-string process ":set -v1"))
nil
(lambda (process _)
(haskell-interactive-mode-echo
@@ -519,11 +518,11 @@
"The sentinel for the process pipe."
(let ((session (haskell-process-project-by-proc proc)))
(when session
- (let ((process (haskell-session-process session)))
- (haskell-process-reset process)
- (haskell-process-log (format "Event: %S\n" event))
- (haskell-process-log "Process reset.\n")
- (haskell-process-prompt-restart process)))))
+ (let* ((process (haskell-session-process session)))
+ (unless (haskell-process-restarting process)
+ (haskell-process-log (format "Event: %S\n" event))
+ (haskell-process-log "Process reset.\n")
+ (haskell-process-prompt-restart process))))))
(defun haskell-process-filter (proc response)
"The filter for the process pipe."
@@ -685,6 +684,10 @@
"Get the process's command queue."
(haskell-process-get process 'command-queue))
+(defun haskell-process-restarting (process)
+ "Is the process restarting?"
+ (haskell-process-get process 'is-restarting))
+
(defun haskell-process-cmd-queue-pop (process)
"Get the process's command queue."
(let ((queue (haskell-process-get process 'command-queue)))

0 comments on commit 5573a64

Please sign in to comment.