Permalink
Browse files

* inf-haskell.el (inferior-haskell-load-and-run): Don't run if there

Ignore-this: 819eb74ae6371f9b68db86d5386ce2ff
* inf-haskell.el (inferior-haskell-load-and-run): Don't run if there
were compilation errors.  Switch to inf-haskell buffer after run.

darcs-hash:20080704063721-c2f2e-4fa4d325be5e4c0bb1091c0041af281375bbcf20.gz
  • Loading branch information...
1 parent 94ad4fc commit 40fa2078cc7ee7a513def556b54df16f2ab9b889 monnier committed Jul 4, 2008
Showing with 13 additions and 3 deletions.
  1. +3 −0 ChangeLog
  2. +10 −3 inf-haskell.el
View
@@ -1,5 +1,8 @@
2008-07-04 Stefan Monnier <monnier@iro.umontreal.ca>
+ * inf-haskell.el (inferior-haskell-load-and-run): Don't run if there
+ were compilation errors. Switch to inf-haskell buffer after run.
+
* inf-haskell.el (inferior-haskell-cabal-of-buf): Don't return
a dead buffer. Reported by Conal Elliott <conal@conal.net>.
(replace-regexp-in-string): Add XEmacs compatibility.
View
@@ -362,9 +362,16 @@ If prefix arg \\[universal-argument] is given, just reload the previous file."
inferior-haskell-run-command
(read-string "Command to run: " nil nil inferior-haskell-run-command))))
(setq inferior-haskell-run-command command)
- (inferior-haskell-load-file)
- ;; FIXME: if the :load encountered errors, we should not `run'.
- (inferior-haskell-send-command (inferior-haskell-process) command))
+ (let* ((inferior-haskell-errors nil)
+ (neh (lambda () (setq inferior-haskell-errors t))))
+ (unwind-protect
+ (let ((inferior-haskell-wait-and-jump t))
+ (add-hook 'next-error-hook neh)
+ (inferior-haskell-load-file))
+ (remove-hook 'next-error-hook neh))
+ (unless inferior-haskell-errors
+ (inferior-haskell-send-command (inferior-haskell-process) command)
+ (switch-to-haskell))))
(defun inferior-haskell-send-command (proc str)
(setq str (concat str "\n"))

0 comments on commit 40fa207

Please sign in to comment.