insert module hack.

This commit is contained in:
Kazu Yamamoto 2012-01-23 15:12:24 +09:00
parent 4e87e389e5
commit cc6a2d7070
3 changed files with 14 additions and 5 deletions

View File

@ -94,6 +94,11 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun ghc-things-at-point ()
(thing-at-point 'sexp))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun ghc-keyword-number-pair (spec)
(let ((len (length spec)) key ret)
(dotimes (i len (nreverse ret))

View File

@ -20,7 +20,7 @@
(ghc-show-type0 ask modname)))))
(defun ghc-show-type0 (ask modname)
(let* ((expr0 (thing-at-point 'symbol))
(let* ((expr0 (ghc-things-at-point))
(expr (if ask (ghc-read-expression expr0) expr0))
(cdir default-directory)
(file (buffer-name)))
@ -40,7 +40,7 @@
(ghc-show-info0 ask modname)))))
(defun ghc-show-info0 (ask modname)
(let* ((expr0 (thing-at-point 'symbol))
(let* ((expr0 (ghc-things-at-point))
(expr (if ask (ghc-read-expression expr0) expr0))
(cdir default-directory)
(file (buffer-name))

View File

@ -14,7 +14,7 @@
(interactive)
(if (not (ghc-which ghc-hoogle-command))
(message "\"%s\" not found" ghc-hoogle-command)
(let* ((expr0 (thing-at-point 'symbol))
(let* ((expr0 (ghc-things-at-point))
(expr (ghc-read-expression expr0)))
(let ((mods (ghc-function-to-modules expr)))
(if (null mods)
@ -30,11 +30,15 @@
(defun ghc-goto-module-position ()
(goto-char (point-max))
(if (re-search-backward "^import" nil t)
(forward-line)
(ghc-goto-empty-line)
(if (re-search-backward "^module" nil t)
(forward-line)
(ghc-goto-empty-line)
(goto-char (point-min)))))
(defun ghc-goto-empty-line ()
(unless (re-search-forward "^$" nil t)
(forward-line)))
(defun ghc-function-to-modules (fn)
(with-temp-buffer
(call-process ghc-hoogle-command nil t nil "search" fn)