4242 nil nil def)
4343 )))
4444
45- (defcustom haskell-hoogle-command
46- (if (executable-find " hoogle" ) " hoogle" )
47- " Name of the command to use to query Hoogle.
48- If nil, use the Hoogle web-site."
49- :group 'haskell
50- :type '(choice (const :tag " Use Web-site" nil )
51- string))
45+ ;;;### autoload
46+ (defun haskell-hoogle (query &optional info )
47+ " Do a Hoogle search for QUERY.
48+
49+ If prefix argument INFO is given, then `haskell-hoogle-command'
50+ is asked to show extra info for the items matching QUERY.."
51+ (interactive (append (hoogle-prompt) current-prefix-arg))
52+ (let* ((command (concat (executable-find " hoogle" )
53+ (if info " -i " " " )
54+ " --color " (shell-quote-argument query)))
55+ (output (shell-command-to-string command)))
56+ (with-help-window " *hoogle*"
57+ (with-current-buffer standard-output
58+ (insert output)
59+ (ansi-color-apply-on-region (point-min ) (point-max ))))))
60+
61+ ;;;### autoload
62+ (defalias 'hoogle 'haskell-hoogle )
5263
5364(defcustom haskell-hoogle-url " https://hoogle.haskell.org/?hoogle=%s"
5465 " Default value for hoogle web site."
@@ -59,6 +70,12 @@ If nil, use the Hoogle web-site."
5970 (const :tag " hayoo" " http://hayoo.fh-wedel.de/?query=%s" )
6071 string))
6172
73+ ;;;### autoload
74+ (defun haskell-hoogle-lookup-from-website (query )
75+ " Lookup QUERY at `haskell-hoogle-url' ."
76+ (interactive (hoogle-prompt))
77+ (browse-url (format haskell-hoogle-url (url-hexify-string query))))
78+
6279(defcustom haskell-hoogle-server-command (lambda (port )
6380 (list " hoogle" " server"
6481 " --local"
@@ -69,35 +86,6 @@ If nil, use the Hoogle web-site."
6986 :type 'function
7087 )
7188
72- ;;;### autoload
73- (defun haskell-hoogle (query &optional info )
74- " Do a Hoogle search for QUERY.
75- When `haskell-hoogle-command' is non-nil, this command runs
76- that. Otherwise, it opens a hoogle search result in the browser.
77-
78- If prefix argument INFO is given, then `haskell-hoogle-command'
79- is asked to show extra info for the items matching QUERY.."
80- (interactive
81- (let ((def (haskell-ident-at-point)))
82- (if (and def (symbolp def)) (setq def (symbol-name def)))
83- (list (read-string (if def
84- (format " Hoogle query (default %s ): " def)
85- " Hoogle query: " )
86- nil nil def)
87- current-prefix-arg)))
88- (if (null haskell-hoogle-command)
89- (browse-url (format haskell-hoogle-url (url-hexify-string query)))
90- (let ((command (concat haskell-hoogle-command
91- (if info " -i " " " )
92- " --color " (shell-quote-argument query))))
93- (with-help-window " *hoogle*"
94- (with-current-buffer standard-output
95- (insert (shell-command-to-string command))
96- (ansi-color-apply-on-region (point-min ) (point-max )))))))
97-
98- ;;;### autoload
99- (defalias 'hoogle 'haskell-hoogle )
100-
10189(defvar haskell-hoogle-server-process-name " emacs-local-hoogle" )
10290(defvar haskell-hoogle-server-buffer-name (format " *%s * " haskell-hoogle-server-process-name))
10391(defvar haskell-hoogle-port-number 49513 " Port number." )
0 commit comments