From aad7cdebe541934ab671d7fd7fcdbac5098715be Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Tue, 15 Sep 2015 16:50:25 +0900 Subject: [PATCH] fixing doc (#599). --- elisp/ghc-doc.el | 18 ++++++++++-------- elisp/ghc-process.el | 2 ++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/elisp/ghc-doc.el b/elisp/ghc-doc.el index 8142a83..fd782ef 100644 --- a/elisp/ghc-doc.el +++ b/elisp/ghc-doc.el @@ -41,14 +41,16 @@ (ghc-defstruct pkg-ver-path pkg ver path) (defun ghc-resolve-document-path (mod) - (with-temp-buffer - (ghc-call-process ghc-module-command nil t nil "doc" mod) - (goto-char (point-min)) - (when (looking-at "^\\([^ ]+\\)-\\([0-9]*\\(\\.[0-9]+\\)*\\) \\(.*\\)$") - (ghc-make-pkg-ver-path - :pkg (match-string-no-properties 1) - :ver (match-string-no-properties 2) - :path (match-string-no-properties 4))))) + (let ((root ghc-process-root)) + (with-temp-buffer + (let ((default-directory root)) + (ghc-call-process ghc-module-command nil t nil "doc" mod)) + (goto-char (point-min)) + (when (looking-at "^\\([^ ]+\\)-\\([0-9]*\\(\\.[0-9]+\\)*\\) \\(.*\\)$") + (ghc-make-pkg-ver-path + :pkg (match-string-no-properties 1) + :ver (match-string-no-properties 2) + :path (match-string-no-properties 4)))))) (defconst ghc-doc-local-format "file://%s/%s.html") (defconst ghc-doc-hackage-format diff --git a/elisp/ghc-process.el b/elisp/ghc-process.el index 75be11d..165d2f9 100644 --- a/elisp/ghc-process.el +++ b/elisp/ghc-process.el @@ -46,6 +46,8 @@ (buf (get-buffer-create (concat " ghc-mod:" name))) (file (buffer-file-name)) (cpro (get-process name))) + ;; setting root in the original buffer, sigh + (setq ghc-process-root root) (ghc-with-current-buffer buf (setq ghc-process-original-buffer cbuf) (setq ghc-process-original-file file)