Skip to content

Commit 2834c55

Browse files
author
Samuel Evans-Powell
committed
Allow user to provide custom hoogle server command
1 parent 4aa8875 commit 2834c55

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

haskell-hoogle.el

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ If nil, use the Hoogle web-site."
4848
(const :tag "hayoo" "http://hayoo.fh-wedel.de/?query=%s")
4949
string))
5050

51+
(defcustom haskell-hoogle-server-command (lambda (port)
52+
(list "hoogle" "server"
53+
"--local"
54+
"-p"
55+
(number-to-string port)))
56+
"Command used to start the local hoogle server."
57+
:group 'haskell
58+
:type 'function
59+
)
60+
5161
;;;###autoload
5262
(defun haskell-hoogle (query &optional info)
5363
"Do a Hoogle search for QUERY.
@@ -85,14 +95,14 @@ is asked to show extra info for the items matching QUERY.."
8595
(defun haskell-hoogle-start-server ()
8696
"Start hoogle local server."
8797
(interactive)
88-
(if (executable-find "hoogle")
89-
(unless (haskell-hoogle-server-live-p)
90-
(set 'haskell-hoogle-server-process
91-
(start-process
92-
haskell-hoogle-server-process-name
93-
(get-buffer-create haskell-hoogle-server-buffer-name)
94-
"hoogle" "server" "-p" (number-to-string haskell-hoogle-port-number))))
95-
(error "\"hoogle\" executable not found")))
98+
(unless (haskell-hoogle-server-live-p)
99+
(set 'haskell-hoogle-server-process
100+
(apply 'start-process
101+
(append (list haskell-hoogle-server-process-name
102+
(get-buffer-create haskell-hoogle-server-buffer-name))
103+
(funcall haskell-hoogle-server-command haskell-hoogle-port-number))))
104+
)
105+
)
96106

97107
(defun haskell-hoogle-server-live-p ()
98108
"Whether the hoogle server process is live."

0 commit comments

Comments
 (0)