eagletmt / ghcmod-vim

Happy Haskell programming on Vim, powered by ghc-mod
http://www.vim.org/scripts/script.php?script_id=4473
433 stars 59 forks source link

Use "ghc-mod version" to detect version instead of get_last_errmsg #50

Closed bflyblue closed 10 years ago

bflyblue commented 10 years ago

I was having trouble using ghcmod-vim on NixOS and tracked it down to the fact ghc-mod gets wrapped by a shell script for which vimproc#get_last_errmsg() returns nothing. This change calls 'ghc-mod version' to extract the version number instead which works with the wrapper.

Note: my VimL skills are weak so there may be a better way of doing this :)

eagletmt commented 10 years ago

The version subcommand has been added very recently, 4.1.0. I'd like to find another solution to this problem.

Could you paste the wrapper shell script?

bflyblue commented 10 years ago

Aah, I was worried about that..

I've posted the wrapper here: https://gist.github.com/bflyblue/93da1260c1dc50ad54e9

.../bin/.ghc-mod-wrapped is the actual ghc-mod binary.

I don't know much about vimproc but from what I could tell 'get_last_errmsg' wasn't returning anything after calling the shell wrapper

the 'ghc-get-packages' bit expands to:

-g "-package-db /nix/store/fglp3m2p4cw85dyj0j3ay8q3q2s80brj-haskell-env-ghc-7.8.2/bin/../lib/ghc-7.8.2/package.conf.d/base-unicode-symbols-0.2.2.4.installedconf" -g "-package-db /nix/store/fglp3m2p4cw85dyj0j3ay8q3q2s80brj-haskell-env-ghc-7.8.2/bin/../lib/ghc-7.8.2/package.conf.d/cmdargs-0.10.7.installedconf" -g "-package-db /nix/store/fglp3m2p4cw85dyj0j3ay8q3q2s80brj-haskell-env-ghc-7.8.2/bin/../lib/ghc-7.8.2/package.conf.d/convertible-1.1.0.0.installedconf" -g "-package-db /nix/store/fglp3m2p4cw85dyj0j3ay8q3q2s80brj-haskell-env-ghc-7.8.2/bin/../lib/ghc-7.8.2/package.conf.d/cpphs-1.18.4.installedconf" -g "-package-db /nix/store/fglp3m2p4cw85dyj0j3ay8q3q2s80brj-haskell-env-ghc-7.8.2/bin/../lib/ghc-7.8.2/package.conf.d/ghc-mod-4.1.1.installedconf" -g "-package-db /nix/store/fglp3m2p4cw85dyj0j3ay8q3q2s80brj-haskell-env-ghc-7.8.2/bin/../lib/ghc-7.8.2/package.conf.d/ghc-syb-utils-0.2.1.2.installedconf" -g "-package-db /nix/store/fglp3m2p4cw85dyj0j3ay8q3q2s80brj-haskell-env-ghc-7.8.2/bin/../lib/ghc-7.8.2/package.conf.d/hashable-1.2.1.0.installedconf" -g "-package-db /nix/store/fglp3m2p4cw85dyj0j3ay8q3q2s80brj-haskell-env-ghc-7.8.2/bin/../lib/ghc-7.8.2/package.conf.d/haskell-src-exts-1.15.0.1.installedconf" -g "-package-db /nix/store/fglp3m2p4cw85dyj0j3ay8q3q2s80brj-haskell-env-ghc-7.8.2/bin/../lib/ghc-7.8.2/package.conf.d/hlint-1.8.61.installedconf" -g "-package-db /nix/store/fglp3m2p4cw85dyj0j3ay8q3q2s80brj-haskell-env-ghc-7.8.2/bin/../lib/ghc-7.8.2/package.conf.d/hscolour-1.20.3.installedconf" -g "-package-db /nix/store/fglp3m2p4cw85dyj0j3ay8q3q2s80brj-haskell-env-ghc-7.8.2/bin/../lib/ghc-7.8.2/package.conf.d/io-choice-0.0.5.installedconf" -g "-package-db /nix/store/fglp3m2p4cw85dyj0j3ay8q3q2s80brj-haskell-env-ghc-7.8.2/bin/../lib/ghc-7.8.2/package.conf.d/lifted-base-0.2.2.1.installedconf" -g "-package-db /nix/store/fglp3m2p4cw85dyj0j3ay8q3q2s80brj-haskell-env-ghc-7.8.2/bin/../lib/ghc-7.8.2/package.conf.d/monad-control-0.3.2.3.installedconf" -g "-package-db /nix/store/fglp3m2p4cw85dyj0j3ay8q3q2s80brj-haskell-env-ghc-7.8.2/bin/../lib/ghc-7.8.2/package.conf.d/mtl-2.1.3.1.installedconf" -g "-package-db /nix/store/fglp3m2p4cw85dyj0j3ay8q3q2s80brj-haskell-env-ghc-7.8.2/bin/../lib/ghc-7.8.2/package.conf.d/polyparse-1.9.installedconf" -g "-package-db /nix/store/fglp3m2p4cw85dyj0j3ay8q3q2s80brj-haskell-env-ghc-7.8.2/bin/../lib/ghc-7.8.2/package.conf.d/syb-0.4.1.installedconf" -g "-package-db /nix/store/fglp3m2p4cw85dyj0j3ay8q3q2s80brj-haskell-env-ghc-7.8.2/bin/../lib/ghc-7.8.2/package.conf.d/text-1.1.1.1.installedconf" -g "-package-db /nix/store/fglp3m2p4cw85dyj0j3ay8q3q2s80brj-haskell-env-ghc-7.8.2/bin/../lib/ghc-7.8.2/package.conf.d/transformers-base-0.4.1.installedconf" -g "-package-db /nix/store/fglp3m2p4cw85dyj0j3ay8q3q2s80brj-haskell-env-ghc-7.8.2/bin/../lib/ghc-7.8.2/package.conf.d/uniplate-1.6.12.installedconf" -g "-package-db /nix/store/fglp3m2p4cw85dyj0j3ay8q3q2s80brj-haskell-env-ghc-7.8.2/bin/../lib/ghc-7.8.2/package.conf.d/unordered-containers-0.2.4.0.installedconf" -g "-package-db /nix/store/fglp3m2p4cw85dyj0j3ay8q3q2s80brj-haskell-env-ghc-7.8.2/bin/../lib/ghc-7.8.2/package.conf.d/zlib-0.5.4.1.installedconf"

On 23 May 2014 13:49, Kohei Suzuki notifications@github.com wrote:

The version subcommand has been added very recently, 4.1.0. I'd like to find another solution to this problem.

Could you paste the wrapper shell script?

— Reply to this email directly or view it on GitHubhttps://github.com/eagletmt/ghcmod-vim/pull/50#issuecomment-43999841 .

eagletmt commented 10 years ago

Hmm, the wrapper shell script doesn't seem to do harm.

I've tried another way to get ghc-mod output. https://github.com/eagletmt/ghcmod-vim/tree/pr50 Could you try out this branch?

bflyblue commented 10 years ago

This seems to be an issue from the NixOS side so I'm going to follow it up there - thank you for looking this from your side!