diff --git a/elisp/ghc-process.el b/elisp/ghc-process.el index f480671..a686eb4 100644 --- a/elisp/ghc-process.el +++ b/elisp/ghc-process.el @@ -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)