emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/haskell-tng-mode 7ae3f46 244/385: more workarounds for hsi


From: ELPA Syncer
Subject: [nongnu] elpa/haskell-tng-mode 7ae3f46 244/385: more workarounds for hsinspect setup
Date: Tue, 5 Oct 2021 23:59:40 -0400 (EDT)

branch: elpa/haskell-tng-mode
commit 7ae3f46d6387eca3db268116e3d6492124ffb91b
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>

    more workarounds for hsinspect setup
---
 README.md                |  9 ++++++++-
 cabal-ghcflags.sh        |  3 +++
 haskell-tng-hsinspect.el | 14 +++++---------
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/README.md b/README.md
index 97567e8..026f8e1 100644
--- a/README.md
+++ b/README.md
@@ -64,10 +64,17 @@ You must install `hsinspect` for every version of `ghc` 
that you plan to use, e.
 rm -f ~/.cabal/bin/hsinspect
 for V in 8.4.4 8.6.5 ; do
   cabal v2-install hsinspect -w ghc-$V &&
-  mv ~/.cabal/bin/hsinspect ~/.cabal/bin/hsinspect-ghc-$V
+  mv -f ~/.cabal/bin/hsinspect ~/.cabal/bin/hsinspect-ghc-$V
 done
 ```
 
+<!--
+for V in 8.4.4 8.6.5 ; do
+  cabal v2-install exe:hsinspect -w ghc-$V &&
+  mv -f ~/.cabal/bin/hsinspect ~/.cabal/bin/hsinspect-ghc-$V
+done
+-->
+
 To use `hsinspect` commands, generate `.ghc.flags` / `.ghc.version` files by 
running `M-x haskell-tng-hsinspect` for a project. This is only needed when the 
dependencies change.
 
 `hsinspect` only works when the dependencies of the current file have been 
compiled (the current file doesn't need to be compilable).
diff --git a/cabal-ghcflags.sh b/cabal-ghcflags.sh
index cb7e78b..fed1132 100755
--- a/cabal-ghcflags.sh
+++ b/cabal-ghcflags.sh
@@ -76,6 +76,9 @@ jq -c '(.["install-plan"][] | select(.["pkg-src"].type == 
"local") | select(.["c
     rm "$OUTPUT" 2> /dev/null || true
     cabal v2-repl -v0 -w "$TMP/ghc" "$NAME:$COMPONENT"
 
+    # TODO also need to provide the PATH, since it might include commands that
+    # are referred to from compiler plugins (e.g. tasty-discover).
+
     # extract all the source directories that use these flags
     for D in $(cat "$OUTPUT" | tr ' ' '\n' | grep '^-i' | sed 's/^-i//' | sed 
'/^$/d') ; do
         if [[ "$D" != /* ]] ; then
diff --git a/haskell-tng-hsinspect.el b/haskell-tng-hsinspect.el
index b06f013..435987d 100644
--- a/haskell-tng-hsinspect.el
+++ b/haskell-tng-hsinspect.el
@@ -58,14 +58,10 @@ change."
   ;; https://github.com/haskell/cabal/issues/6203
   "Obtain the ghc flags for the current buffer"
   (if-let (default-directory (locate-dominating-file default-directory 
".ghc.flags"))
-      (seq-map
-       ;; hsinspect works best if we trick the compiler into thinking that the
-       ;; file we are inspecting is independent of the current unit.
-       (lambda (e) (if (equal e "-this-unit-id") "-package-id" e))
-       (with-temp-buffer
-         (insert-file-contents (expand-file-name ".ghc.flags"))
-         (split-string
-          (buffer-substring-no-properties (point-min) (point-max)))))
+      (with-temp-buffer
+        (insert-file-contents (expand-file-name ".ghc.flags"))
+        (split-string
+         (buffer-substring-no-properties (point-min) (point-max))))
     (user-error "could not find `.ghc.flags'. Run `M-x 
haskell-tng-hsinspect'")))
 
 (defun haskell-tng--hsinspect-ghc ()
@@ -102,7 +98,7 @@ t means the process failed.")
                  (haskell-tng--hsinspect-ghc)
                  nil "*hsinspect*" nil
                  ;; need to disable all warnings
-                 (append `("imports" ,buffer-file-name "--") ghcflags 
'("-w")))))
+                 (append `("imports" ,buffer-file-name "--") ghcflags))))
           (user-error "`hsinspect' failed. See the *hsinspect* buffer for more 
information")
         (setq haskell-tng--hsinspect-imports
               (with-current-buffer "*hsinspect*"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]