about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-07-03T03·20-0400
committerglittershark <grfn@gws.fyi>2020-07-03T14·41+0000
commit2ec3254f85b43312257abf03e16a1e906324ed89 (patch)
tree0e244c79271a53365d6a047e742ebe1b98670129
parentf980f0f6bd1149c8944a81efc793d32fb54c01f7 (diff)
feat(gs/emacs): Update hie invocation for depot r/1191
Update the invocation of the hie.sh script as part of
+grfn/haskell-mode-setup to be compatible with the new depot-integrated
xanthous.

Change-Id: Ia3ef50fb08464a533efdfed4da66e2be00446ea6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/891
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
Reviewed-by: BuildkiteCI
-rw-r--r--users/glittershark/emacs.d/config.el27
1 files changed, 15 insertions, 12 deletions
diff --git a/users/glittershark/emacs.d/config.el b/users/glittershark/emacs.d/config.el
index 59efa211c5ec..a2b05399fd03 100644
--- a/users/glittershark/emacs.d/config.el
+++ b/users/glittershark/emacs.d/config.el
@@ -702,16 +702,18 @@
   (flymake-mode -1)
   ;; If there’s a 'hie.sh' defined locally by a project
   ;; (e.g. to run HIE in a nix-shell), use it…
-  (let ((hie-directory (locate-dominating-file default-directory "hie.sh")))
-    (when hie-directory
-      (setq-local lsp-haskell-process-path-hie (expand-file-name "hie.sh" hie-directory))
+  (when-let ((project-dir (locate-dominating-file default-directory "hie.sh")))
+    (cl-flet
+        ((which (cmd)
+                (s-trim
+                 (shell-command-to-string
+                  (concat
+                   "nix-shell "
+                   (expand-file-name "shell.nix" project-dir)
+                   " --run \"which " cmd "\" 2>/dev/null")))))
       (setq-local
-       haskell-hoogle-command
-       (s-trim
-        (shell-command-to-string
-         (concat
-          "nix-shell " (expand-file-name "shell.nix" hie-directory)
-          " --run \"which hoogle\" 2>/dev/null"))))))
+       lsp-haskell-process-path-hie (expand-file-name "hie.sh" project-dir)
+       haskell-hoogle-command (which "hoogle"))))
   ;; … and only then setup the LSP.
   (lsp))
 
@@ -727,9 +729,10 @@
   ;; (haskell-mode . lsp-haskell-enable)
   :config
   (add-hook 'haskell-mode-hook #'+grfn/haskell-mode-setup 't)
-  (setq lsp-haskell-process-path-hie "/home/griffin/.nix-profile/bin/hie-8.6.5"
-        lsp-haskell-process-args-hie
-        '("-d" "-l" "/tmp/hie.log" "+RTS" "-M4G" "-H1G" "-K4G" "-A16M" "-RTS")))
+  (setq
+   ;; lsp-haskell-process-path-hie "/home/griffin/.nix-profile/bin/hie-8.6.5"
+   lsp-haskell-process-args-hie
+   '("-d" "-l" "/tmp/hie.log" "+RTS" "-M4G" "-H1G" "-K4G" "-A16M" "-RTS")))
 
 (use-package! lsp-imenu
   :after (lsp-mode lsp-ui)