fixing a bug of doc-browsing.

This commit is contained in:
Kazu Yamamoto 2010-11-10 11:47:54 +09:00
parent a5d12ad707
commit 6bac8141db

View File

@ -16,13 +16,15 @@
(let* ((mod0 (ghc-extract-module))
(mod (ghc-read-module-name mod0))
(pkg (ghc-resolve-package-name mod)))
(ghc-display-document pkg mod haskell-org)))
(if (and pkg mod)
(ghc-display-document pkg mod haskell-org)
(message "No document found"))))
(defun ghc-resolve-package-name (mod)
(with-temp-buffer
(call-process "ghc-pkg" nil t nil "find-module" "--simple-output" mod)
(goto-char (point-min))
(when (re-search-forward "\\([^ ]+\\)-\\([0-9]*\\(\\.[0-9]+\\)*\\)$")
(when (re-search-forward "\\([^ ]+\\)-\\([0-9]*\\(\\.[0-9]+\\)*\\)$" nil t)
(ghc-make-pkg-ver
:pkg (match-string-no-properties 1)
:ver (match-string-no-properties 2)))))