Merge branch 'master' of github.com:kazu-yamamoto/ghc-mod

This commit is contained in:
Daniel Gröber 2015-08-13 10:10:08 +02:00
commit b58578c48b
3 changed files with 26 additions and 24 deletions

View File

@ -137,7 +137,7 @@ nil does not display errors/warnings.
info infos) info infos)
(dolist (err errs (nreverse infos)) (dolist (err errs (nreverse infos))
(when (string-match regex err) (when (string-match regex err)
(let* ((file (expand-file-name (match-string 1 err) (ghc-get-project-root))) ;; for Windows (let* ((file (expand-file-name (match-string 1 err) ghc-process-root)) ;; for Windows
(line (string-to-number (match-string 2 err))) (line (string-to-number (match-string 2 err)))
(coln (string-to-number (match-string 3 err))) (coln (string-to-number (match-string 3 err)))
(msg (match-string 4 err)) (msg (match-string 4 err))

View File

@ -19,6 +19,7 @@
(defvar-local ghc-process-original-file nil) (defvar-local ghc-process-original-file nil)
(defvar-local ghc-process-callback nil) (defvar-local ghc-process-callback nil)
(defvar-local ghc-process-hook nil) (defvar-local ghc-process-hook nil)
(defvar-local ghc-process-root nil)
(defvar ghc-command "ghc-mod") (defvar ghc-command "ghc-mod")
@ -28,28 +29,30 @@
(ghc-run-ghc-mod '("root"))) (ghc-run-ghc-mod '("root")))
(defun ghc-with-process (cmd callback &optional hook1 hook2) (defun ghc-with-process (cmd callback &optional hook1 hook2)
(unless ghc-process-process-name (let ((root (ghc-get-project-root)))
(setq ghc-process-process-name (ghc-get-project-root))) (unless ghc-process-process-name
(when (and ghc-process-process-name (not ghc-process-running)) (setq ghc-process-process-name root))
(setq ghc-process-running t) (when (and ghc-process-process-name (not ghc-process-running))
(if hook1 (funcall hook1)) (setq ghc-process-running t)
(let* ((cbuf (current-buffer)) (if hook1 (funcall hook1))
(name ghc-process-process-name) (let* ((cbuf (current-buffer))
(buf (get-buffer-create (concat " ghc-mod:" name))) (name ghc-process-process-name)
(file (buffer-file-name)) (buf (get-buffer-create (concat " ghc-mod:" name)))
(cpro (get-process name))) (file (buffer-file-name))
(ghc-with-current-buffer buf (cpro (get-process name)))
(setq ghc-process-original-buffer cbuf) (ghc-with-current-buffer buf
(setq ghc-process-original-file file) (setq ghc-process-original-buffer cbuf)
(setq ghc-process-callback callback) (setq ghc-process-original-file file)
(setq ghc-process-hook hook2) (setq ghc-process-callback callback)
(erase-buffer) (setq ghc-process-hook hook2)
(let ((pro (ghc-get-process cpro name buf))) (setq ghc-process-root root)
(process-send-string pro cmd) (erase-buffer)
(when ghc-debug (let ((pro (ghc-get-process cpro name buf)))
(ghc-with-debug-buffer (process-send-string pro cmd)
(insert (format "%% %s" cmd)))) (when ghc-debug
pro))))) (ghc-with-debug-buffer
(insert (format "%% %s" cmd))))
pro))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -146,7 +146,6 @@
(insert "\nVersion: all GHC versions must be the same.\n") (insert "\nVersion: all GHC versions must be the same.\n")
(insert (format "\t ghc.el version %s\n" el-ver)) (insert (format "\t ghc.el version %s\n" el-ver))
(insert (format "\t %s\n" ghc-mod-ver)) (insert (format "\t %s\n" ghc-mod-ver))
(insert (format "\t%s\n" ghc-modi-ver))
(insert (format "\t%s\n" ghc-ver)) (insert (format "\t%s\n" ghc-ver))
(insert "\nEnvironment variables:\n") (insert "\nEnvironment variables:\n")
(insert (format "\tPATH=%s\n" path)))) (insert (format "\tPATH=%s\n" path))))