[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/haskell-tng-mode 4e2cf00 284/385: simplify the installatio
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/haskell-tng-mode 4e2cf00 284/385: simplify the installation of hsinspect |
Date: |
Tue, 5 Oct 2021 23:59:49 -0400 (EDT) |
branch: elpa/haskell-tng-mode
commit 4e2cf006eb8c544ace8aafd2e8375dcb31dd8c8e
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>
simplify the installation of hsinspect
---
README.md | 19 ++++++-------------
haskell-tng-hsinspect.el | 29 ++++++++++++++++-------------
2 files changed, 22 insertions(+), 26 deletions(-)
diff --git a/README.md b/README.md
index 6435488..b355e60 100644
--- a/README.md
+++ b/README.md
@@ -63,25 +63,18 @@ A full installation may look like the following
The optional command line tool
[`hsinspect`](https://gitlab.com/tseenshe/hsinspect) provides semantic
information by using the `ghc` api.
-You must install `hsinspect` for every version of `ghc` that you plan to use,
e.g.
+To use this feature you must install `hsinspect` command line tool and the
`ghcflags` plugin to every `.cabal` file:
-```
-rm -f ~/.cabal/bin/hsinspect
-for V in 8.4.4 8.6.5 ; do
- cabal v2-install hsinspect-0.0.7 -w ghc-$V -O2 &&
- mv -f ~/.cabal/bin/hsinspect ~/.cabal/bin/hsinspect-ghc-$V
-done
-```
-
-And add the `ghcflags` compiler plugin to every project you plan to inspect:
-
-1. add a `build-depends` on `ghcflags`
-2. add `-fplugin GhcFlags.Plugin` to `ghc-options`
+1. `build-tool-depends: hsinspect-0.0.7` (or make `hsinspect` available
globally, self-managing `ghc` versions)
+2. `build-depends: ghcflags-1.0.1`
+3. add `ghc-options: -fplugin GhcFlags.Plugin`
The `haskell-tng-extra-company` package will automatically complete symbols
that are in scope.
To find out which module a symbol belongs to, use `M-x
haskell-tng-fqn-at-point`.
+To automatically import a symbol at point, use `M-x
haskell-tng-import-symbol-at-point`.
+
## Contrib
Integrations are provided for common libraries and external applications.
diff --git a/haskell-tng-hsinspect.el b/haskell-tng-hsinspect.el
index 45332a2..f9085a7 100644
--- a/haskell-tng-hsinspect.el
+++ b/haskell-tng-hsinspect.el
@@ -104,18 +104,6 @@ name of the symbol at point in the minibuffer."
(buffer-substring-no-properties (point-min) (point-max))))
(user-error "could not find `.ghc.flags'.")))
-;; TODO rely on the build tool launching hsinspect, then drop .ghc.version
-;; (need a way to ensure we launch from the correct PWD)
-(defun haskell-tng--hsinspect-ghc ()
- "Obtain the version of hsinspect that matches the project's compiler."
- (if-let (default-directory (locate-dominating-file default-directory
".ghc.version"))
- (with-temp-buffer
- (insert-file-contents (expand-file-name ".ghc.version"))
- (concat
- "hsinspect-ghc-"
- (string-trim (buffer-substring-no-properties (point-min)
(point-max)))))
- (user-error "could not find `.ghc.version'.")))
-
;; TODO invalidate cache when imports section has changed
(defvar-local haskell-tng--hsinspect-imports nil
"Cache for the last `imports' call for this buffer.
@@ -139,6 +127,21 @@ t means the process failed.")
(setq haskell-tng--hsinspect-index
(haskell-tng--hsinspect "index"))))
+(defvar-local haskell-tng--hsinspect-exe nil)
+(defvar haskell-tng--hsinspect-which-hsinspect
+ "cabal exec -v0 which -- hsinspect")
+(defun haskell-tng--hsinspect-exe ()
+ "The binary to use for `hsinspect'"
+ (or
+ haskell-tng--hsinspect-exe
+ (setq
+ haskell-tng--hsinspect-exe
+ (let ((which (string-trim (shell-command-to-string
haskell-tng--hsinspect-which-hsinspect))))
+ (if (file-exists-p which)
+ which
+ ;; fall back to system installed binary
+ "hsinspect")))))
+
(defun haskell-tng--hsinspect (&rest params)
(ignore-errors (kill-buffer "*hsinspect*"))
(when-let ((ghcflags (haskell-tng--hsinspect-ghcflags))
@@ -148,7 +151,7 @@ t means the process failed.")
(apply
#'call-process
;; TODO async
- (haskell-tng--hsinspect-ghc)
+ (haskell-tng--hsinspect-exe)
nil "*hsinspect*" nil
(append params '("--") ghcflags))))
(user-error "`hsinspect' failed. See the *hsinspect* buffer for more
information")
- [nongnu] elpa/haskell-tng-mode 99a7f10 337/385: cleanup, (continued)
- [nongnu] elpa/haskell-tng-mode 99a7f10 337/385: cleanup, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode e6d8761 343/385: local jump-to-definition should error, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode c31afdb 272/385: missing CPP case, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 85c4dd5 233/385: fix bugfix in goto-import, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 5c157fb 255/385: rigid ormolu support, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 64ec84d 260/385: if/then/else indentation, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 1d53572 243/385: bugfixes, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode d1e599a 285/385: switch formatting backend based on project config, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode fd06b8f 264/385: move haskell-tng-newline into the -extra package, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 8ff79e7 247/385: allow parallelism, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 4e2cf00 284/385: simplify the installation of hsinspect,
ELPA Syncer <=
- [nongnu] elpa/haskell-tng-mode 1107e63 274/385: bump hsinspect, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 8475578 311/385: typos, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode f8d2b91 295/385: miss some false positive ghc errors, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode fca5c6e 315/385: better docs and cabal-install support, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode b2e19c9 318/385: document next steps, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode c39d0f4 321/385: some hsinspect tests, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 5fe4cb1 359/385: cleanup test includes, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 38ed1b7 326/385: import types, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 6d4e150 353/385: upgrade hsinspect version, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 4f84cde 347/385: improve importing qualified symbols, ELPA Syncer, 2021/10/06