Open rongcuid opened 8 years ago
My current work around is the following wrapper script. It seems to work, though emacs highlights errors on the "literate" part of literate haskell. The highlight problem magically fixed somehow. But I would still like to be able to set the commands directly in Emacs
#!/bin/bash
# ~/.local/bin/ghc-mod
cmd=$1
shift
stack --verbosity silent exec -- ghc-mod $cmd "$@"
I know this is a workaround that is currently needed for most more complicated stack setups but going forward I would like ghc-mod to handle this for you.
Once we implement https://github.com/kazu-yamamoto/ghc-mod/issues/615 this use case should either disappear completely or at least it would become very easy to check if we have to do this workaround instead.
I suppose it would be possible to check if this workaround is necessary and just use it right now, but it is sort of really ugly to have to install one instance of ghc-mod globally (linked against any version of ghc) just so we can use it to dispatch to the right "real" ghc-mod we want to use with a stack project.
So in short I think Elisp is the wrong place for this since, as with every hack we do there, all other frontends also have to implement something equivalent. Leading to even more duplication of logic and effort.
If someone wants to give implementing either of these a shot I'm happy to consider the PR.
Since I am using
stack
and currently onlystack
, the command to invokeghc
is actually a scriptghc-wrapper
which actually executesstack ghc -- <options>
. However, I don't see any way to have ghc-mod emacs mode use any of the alternatives. I looked into the customize variables, and tried usingghc-wrapper
, which does not seem to work:ghc-debug:
Then, all packages imported that are installed in stack is marked error. If I execute this:
I get:
While the following works (Well, OK, some warnings):