Add ability to select build target to haskell-mode through shm.
This is just a stop gap. The build target is stored in a haskell-mode custome varialble.
The query to set the build target (this commit) is added to existing shm code. This is just
to get a client up and running but will be refactored into its own entitiy soon.
diff --git a/elisp/hsq-cabal.el b/elisp/hsq-cabal.el
new file mode 100644
index 0000000..bc1302e
--- /dev/null
+++ b/elisp/hsq-cabal.el
@@ -0,0 +1,35 @@
+;;; package --- Summary
+
+;;; Commentary:
+
+(require 'ido)
+(require 'json)
+
+(defun haskell-src-query-build-targets ()
+ (let ((message-log-max nil)
+ (buffer (current-buffer))
+ (cabal-file (haskell-cabal-find-file)))
+ (with-temp-buffer
+ (let ((temp-buffer (current-buffer)))
+ (with-current-buffer buffer
+ (condition-case e
+ (call-process shm-program-name
+ nil
+ temp-buffer
+ nil
+ "targets"
+ "Emacs"
+ (format "--cabal-file=%s" cabal-file))
+ ((file-error)
+ (error "cannot find haskell-src-query executable")))))
+ (json-read-from-string (buffer-string)))))
+
+
+ (defun haskell-session-select-build-target()
+ (interactive)
+ (haskell-session-set-target (haskell-session)
+ (ido-completing-read "Build Target:"
+ (append (haskell-src-query-build-targets) nil))))
+
+
+(provide 'hsq-cabal)
diff --git a/elisp/shm.el b/elisp/shm.el
index 5e9a6de..415ce4d 100644
--- a/elisp/shm.el
+++ b/elisp/shm.el
@@ -34,6 +34,7 @@
(require 'shm-node)
(require 'shm-lambda)
(require 'shm-context-menu)
+(require 'hsq-cabal)
(require 'cl)
(require 'json)
diff --git a/src/HSrcQuery.hs b/src/HSrcQuery.hs
index 3c83837..bc7b366 100644
--- a/src/HSrcQuery.hs
+++ b/src/HSrcQuery.hs
@@ -9,6 +9,9 @@
import HLint
import Lambda
import ParseAST
+------------------------------------------------------------------------------
+import Distribution.PackageDescription.Parse
+import Distribution.Verbosity
------------------------------------------------------------------------------
data Query = FreeVariables