defining ghc-debug.

This commit is contained in:
Kazu Yamamoto 2014-03-14 14:01:07 +09:00
parent 90cc99f203
commit 6ae822f00e
5 changed files with 25 additions and 7 deletions

View File

@ -100,7 +100,7 @@ unloaded modules are loaded")
(ghc-read-lisp-list
(lambda ()
(message "Initializing...")
(call-process ghc-module-command nil t nil "-l" "boot")
(ghc-call-process ghc-module-command nil t nil "-l" "boot")
(message "Initializing...done"))
n)))
@ -109,7 +109,7 @@ unloaded modules are loaded")
(ghc-read-lisp-list
(lambda ()
(message "Loading names...")
(apply 'call-process ghc-module-command nil '(t nil) nil
(apply 'ghc-call-process ghc-module-command nil '(t nil) nil
`(,@(ghc-make-ghc-options) "-l" "browse" ,@mods))
(message "Loading names...done"))
(length mods))))

View File

@ -34,7 +34,7 @@
(defun ghc-resolve-package-name (mod)
(with-temp-buffer
(call-process "ghc-pkg" nil t nil "find-module" "--simple-output" mod)
(ghc-call-process "ghc-pkg" nil t nil "find-module" "--simple-output" mod)
(goto-char (point-min))
(when (re-search-forward "\\([^ ]+\\)-\\([0-9]*\\(\\.[0-9]+\\)*\\)$" nil t)
(ghc-make-pkg-ver
@ -43,7 +43,7 @@
(defun ghc-resolve-document-path (pkg)
(with-temp-buffer
(call-process "ghc-pkg" nil t nil "field" pkg "haddock-html")
(ghc-call-process "ghc-pkg" nil t nil "field" pkg "haddock-html")
(goto-char (point-max))
(forward-line -1)
(beginning-of-line)

View File

@ -166,7 +166,7 @@
(let ((cdir default-directory))
(with-temp-buffer
(cd cdir)
(apply 'call-process ghc-module-command nil t nil
(apply 'ghc-call-process ghc-module-command nil t nil
(append (ghc-make-ghc-options) cmds))
(buffer-substring (point-min) (1- (point-max)))))))
@ -178,4 +178,22 @@
(put 'ghc-executable-find 'lisp-indent-function 1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar ghc-debug nil)
(defvar ghc-debug-buffer "*GHC Debug*")
(defun ghc-call-process (cmd x y z &rest args)
(when ghc-debug
(with-current-buffer (set-buffer (get-buffer-create ghc-debug-buffer))
(goto-char (point-max))
(insert (format "%% %s %s\n" cmd (mapconcat 'identity args " ")))))
(apply 'call-process cmd x y z args)
(when ghc-debug
(let ((cbuf (current-buffer)))
(with-current-buffer (set-buffer (get-buffer-create ghc-debug-buffer))
(goto-char (point-max))
(insert-buffer-substring cbuf)))))
(provide 'ghc-func)

View File

@ -119,7 +119,7 @@
(ghc-read-lisp
(lambda ()
(cd cdir)
(apply 'call-process ghc-module-command nil t nil
(apply 'ghc-call-process ghc-module-command nil t nil
`(,@(ghc-make-ghc-options) "-l" "type" ,file ,modname ,ln ,cn))
(goto-char (point-min))
(while (search-forward "[Char]" nil t)

View File

@ -53,7 +53,7 @@
(concat "(" fn ")")))
(regex (concat "^\\([a-zA-Z0-9.]+\\) " fn1 " "))
ret)
(call-process ghc-hoogle-command nil t nil "search" fn1)
(ghc-call-process ghc-hoogle-command nil t nil "search" fn1)
(goto-char (point-min))
(while (re-search-forward regex nil t)
(setq ret (cons (match-string 1) ret)))