1 ; an example of hoogle search integration in emacs haskell mode
2 ; load from or add to your .emacs
4 (require 'haskell-mode
)
5 (define-key haskell-mode-map
"\C-ch" 'haskell-hoogle
)
6 (define-key haskell-mode-map
"\C-cd" 'darcs-hoogle
)
8 ; to show results in emacs, provide the full path of darcs/tools/darcshoogle:
9 ;(setq darcs-hoogle-command (expand-file-name "~/src/darcs/tools/darcshoogle"))
10 ; or leave it nil to show results in a web browser:
11 (setq darcs-hoogle-command nil
)
13 (setq darcs-hoogle-url
"http://joyful.com/repos/darcs-unstable/hoogle")
15 ; a copy of haskell-hoogle that calls the darcs web or command-line hoogle
16 (defun darcs-hoogle (query)
17 "Do a Hoogle search for QUERY in darcs code."
19 (let ((def (haskell-ident-at-point)))
20 (if (and def
(symbolp def
)) (setq def
(symbol-name def
)))
21 (list (read-string (if def
22 (format "Darcs hoogle query (default %s): " def
)
23 "Darcs hoogle query: ")
25 (if (null darcs-hoogle-command
)
26 (browse-url (format (concat darcs-hoogle-url
"/?q=%s") query
))
27 (if (fboundp 'help-setup-xref
)
28 (help-setup-xref (list 'darcs-hoogle query
) (interactive-p)))
29 (with-output-to-temp-buffer
30 (if (fboundp 'help-buffer
) (help-buffer) "*Help*")
31 (with-current-buffer standard-output
32 (start-process "darcshoogle" (current-buffer) darcs-hoogle-command