making ghc-mod-running a global var (##255).
This commit is contained in:
parent
7af19f5400
commit
7d81a357f7
@ -12,7 +12,8 @@
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defvar-local ghc-process-running nil)
|
||||
(defvar ghc-process-running nil)
|
||||
|
||||
(defvar-local ghc-process-process-name nil)
|
||||
(defvar-local ghc-process-original-buffer nil)
|
||||
(defvar-local ghc-process-original-file nil)
|
||||
@ -29,7 +30,8 @@
|
||||
(defun ghc-with-process (cmd callback &optional hook1 hook2)
|
||||
(unless ghc-process-process-name
|
||||
(setq ghc-process-process-name (ghc-get-project-root)))
|
||||
(when ghc-process-process-name
|
||||
(when (and ghc-process-process-name (not ghc-process-running))
|
||||
(setq ghc-process-running t)
|
||||
(if hook1 (funcall hook1))
|
||||
(let* ((cbuf (current-buffer))
|
||||
(name ghc-process-process-name)
|
||||
@ -37,8 +39,6 @@
|
||||
(file (buffer-file-name))
|
||||
(cpro (get-process name)))
|
||||
(ghc-with-current-buffer buf
|
||||
(unless ghc-process-running
|
||||
(setq ghc-process-running t)
|
||||
(setq ghc-process-original-buffer cbuf)
|
||||
(setq ghc-process-original-file file)
|
||||
(setq ghc-process-callback callback)
|
||||
@ -49,7 +49,7 @@
|
||||
(when ghc-debug
|
||||
(ghc-with-debug-buffer
|
||||
(insert (format "%% %s" cmd))))
|
||||
pro))))))
|
||||
pro)))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
@ -69,6 +69,9 @@
|
||||
pro))
|
||||
|
||||
(defun ghc-process-filter (process string)
|
||||
(let ((pbuf (process-buffer process)))
|
||||
(if (not (get-buffer pbuf))
|
||||
(setq ghc-process-running nil) ;; just in case
|
||||
(ghc-with-current-buffer (process-buffer process)
|
||||
(goto-char (point-max))
|
||||
(insert string)
|
||||
@ -89,7 +92,7 @@
|
||||
(let ((cbuf (current-buffer)))
|
||||
(ghc-with-debug-buffer
|
||||
(insert-buffer-substring cbuf))))
|
||||
(setq ghc-process-running nil)))))
|
||||
(setq ghc-process-running nil)))))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
@ -98,6 +101,7 @@
|
||||
(defvar ghc-process-results nil)
|
||||
|
||||
(defun ghc-sync-process (cmd &optional n hook)
|
||||
(unless ghc-process-running
|
||||
(setq ghc-process-rendezvous nil)
|
||||
(setq ghc-process-results nil)
|
||||
(setq ghc-process-num-of-results (or n 1))
|
||||
@ -110,9 +114,8 @@
|
||||
;; (discard-input) avoids getting stuck.
|
||||
(discard-input))
|
||||
(quit
|
||||
(ghc-with-current-buffer (process-buffer pro)
|
||||
(setq ghc-process-running nil)))))
|
||||
ghc-process-results)
|
||||
(setq ghc-process-running nil))))
|
||||
ghc-process-results))
|
||||
|
||||
(defun ghc-process-callback (status)
|
||||
(cond
|
||||
|
Loading…
Reference in New Issue
Block a user