(discard-input) avoids getting stuck.

This commit is contained in:
Kazu Yamamoto 2014-04-28 21:27:27 +09:00
parent 411a584bb8
commit 0d494f3c8e

View File

@ -48,7 +48,8 @@
(process-send-string pro cmd)
(when ghc-debug
(ghc-with-debug-buffer
(insert (format "%% %s" cmd))))))))))
(insert (format "%% %s" cmd))))
pro))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -100,9 +101,17 @@
(setq ghc-process-rendezvous nil)
(setq ghc-process-results nil)
(setq ghc-process-num-of-results (or n 1))
(ghc-with-process cmd 'ghc-process-callback nil hook)
(while (null ghc-process-rendezvous)
(sit-for 0.1))
(let ((pro (ghc-with-process cmd 'ghc-process-callback nil hook)))
(condition-case nil
(while (null ghc-process-rendezvous)
;; 0.1 is too fast for Emacs 24.4.
;; (sit-for 0.1 t) may get stuck when tooltip is displayed.
(sit-for 0.1)
;; (discard-input) avoids getting stuck.
(discard-input))
(quit
(with-current-buffer (process-buffer pro)
(setq ghc-process-running nil)))))
ghc-process-results)
(defun ghc-process-callback (status)