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

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

[nongnu] elpa/haskell-tng-mode 4dc6f76 313/385: fix hsinspect discoverab


From: ELPA Syncer
Subject: [nongnu] elpa/haskell-tng-mode 4dc6f76 313/385: fix hsinspect discoverability
Date: Tue, 5 Oct 2021 23:59:55 -0400 (EDT)

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

    fix hsinspect discoverability
---
 haskell-tng-extra-stack.el |  2 +-
 haskell-tng-hsinspect.el   | 21 +++++++++++++--------
 haskell-tng-util.el        |  5 ++---
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/haskell-tng-extra-stack.el b/haskell-tng-extra-stack.el
index ee0ab33..95c4084 100644
--- a/haskell-tng-extra-stack.el
+++ b/haskell-tng-extra-stack.el
@@ -14,7 +14,7 @@
 
 (setq
  haskell-tng--compile-dominating-project (rx "stack.yaml")
- haskell-tng--hsinspect-which-hsinspect "stack exec --silent which -- 
hsinspect"
+ haskell-tng--hsinspect-which-hsinspect "stack build --silent hsinspect && 
stack exec --silent which -- hsinspect"
  haskell-tng--compile-history '("stack build --fast --no-interleaved-output 
--ghc-options=\"-j\" --no-run-tests"
                                 "stack build --fast --no-interleaved-output 
--ghc-options=\"-j\""))
 
diff --git a/haskell-tng-hsinspect.el b/haskell-tng-hsinspect.el
index e002be9..a7c647f 100644
--- a/haskell-tng-hsinspect.el
+++ b/haskell-tng-hsinspect.el
@@ -150,23 +150,28 @@ A prefix argument ensures that caches are flushes."
      flush-cache)))
 
 (defvar haskell-tng--hsinspect-which-hsinspect
-  "cabal exec -v0 which -- hsinspect")
+  "cabal build -v0 hsinspect && cabal exec -v0 which -- hsinspect")
 (defun haskell-tng--hsinspect-which-hsinspect ()
   "Finds and checks the hsinspect binary for the current buffer.
 
 This is uncached, prefer `haskell-tng--hsinspect-exe'."
-  (let ((bin
-         (string-trim
-          (shell-command-to-string
-           haskell-tng--hsinspect-which-hsinspect))))
+  (let ((supported '("0.0.7" "0.0.8"))
+        (bin
+         (car
+          (last
+           (split-string
+            (string-trim
+             (shell-command-to-string
+              haskell-tng--hsinspect-which-hsinspect))
+            "\n")))))
     (if (file-executable-p bin)
         (let ((version
                (string-trim
                 (shell-command-to-string (concat bin " --version")))))
-          (if (member version '("0.0.7" "0.0.8"))
+          (if (member version supported)
+              ;; TODO from 0.0.8+ do a --ghc-version check (a common failure 
mode)
               bin
-            (user-error "The hsinspect binary is the wrong version: %S" 
version)))
-      ;; TODO from 0.0.8+ do a --ghc-version check (a common failure mode)
+            (user-error "The hsinspect binary is the wrong version: got `%s' 
require `%s'" version supported)))
       (user-error "The hsinspect binary is not executable: %S" bin))))
 
 (defun haskell-tng--hsinspect (flush-cache &rest params)
diff --git a/haskell-tng-util.el b/haskell-tng-util.el
index a4472dd..c945dbc 100644
--- a/haskell-tng-util.el
+++ b/haskell-tng-util.el
@@ -155,14 +155,13 @@ nil return values are NOT cached.
 NO-WORK skips WORK and only queries the cache.
 
 RESET deletes the cache if it exists."
-  (let ((cache-file
+  (let (jka-compr-verbose ;; disables gzip noise
+        (cache-file
          (concat (xdg-cache-home) "/haskell-tng/" key ".gz")))
     (when (and reset (file-exists-p cache-file))
       (delete-file cache-file))
     (if (file-exists-p cache-file)
         (with-temp-buffer
-          ;; TODO set jka-compr-verbose to nil to disable messages (currently
-          ;;      giving useful debugging hints so left on).
           (insert-file-contents cache-file)
           (goto-char (point-min))
           (ignore-errors (read (current-buffer))))



reply via email to

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