ghc-mod
ghc-mod copied to clipboard
add elispPath command to bootstrap elisp code from ghc-mod installation
Per #358 this adds an elispPath command which prints out the elisp directory in the ghc-mod installation. Adds a separate elisp-bootstrap directory with elisp code to call ghc-mod with elispPath and load the real code.
I don't really know what I'm doing in elisp but this worked for me. Here's what is in my initialization for emacs:
(add-to-list 'load-path "~/src/ghc-mod/elisp-bootstrap")
(load "ghc-mod")
(add-hook 'haskell-mode-hook (lambda () (ghc-bootstrap)))
(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
Presumably you'd be able to take the elisp-boostrap dir and upload it to MELPA which would work for all future versions of ghc-mod. Possible enhancements would include better error reporting, in particular if ghc-mod isn't found then it should tell the user to install ghc-mod and ensure that it's on the PATH.
If we want this to land on MELPA we have to move it to elisp/ or change this: https://github.com/milkypostman/melpa/blob/master/recipes/ghc. MELPA just pulls the package from git so it'll update as soon as we merge this.
Another improvement would be to check to make sure that ghc-mod understands the elispPath command. Having an old version would be essentially the same error as not having it installed at all, but it would be helpful if it mentioned that an old, incompatible, version was found.
Perhaps then we would move the current elisp code out of elisp/ and move the bootstrap code into there.
What's up with that Makefile? Is that a template you got from somewhere?
I got it from the elisp dir
Oh rite xD, I could swear I've never seen that thing before. I'm not really sure why we need that especially the archive and bump targets seem dated.
I just added some stuff to deal with versions and ./scripts/bump.sh. Not sure if it works because I don't have GNU sed or tac here right now (on OS X).
You know I'm not so sure I like the approach. If we go with this we'll be stuck with people having (ghc-bootstrap) in their init files forever. Our current entrypoint (ghc-init) is bad enough I'd much rather have it be (ghc-mod-mode) as with just about every other Emacs minor mode but that's complicated by the fact that we can't currently undo all of ghc-init's effects :/
Anyways since we're already stuck with (ghc-init) you might as well rename ghc-bootstrap -> ghc-init so then people won't have to change anything in their emacs init, you'd just have to install the new version of the ghc package and it would just work. So we don't get name conflicts we should rename ghc-init in elisp/ to something else.
Also have a look at this (https://github.com/kazu-yamamoto/ghc-mod/compare/master...DanielG:dev-elisp-simple) branch I started doing some cleanup ages ago maybe you can base this on that branch. Dunno if it's useful though.
One problem at a time I guess? We could do something like this now, and work on isolating the effects and such for ghc-mod-mode later.
Renaming things sound fine to me. Should we still rename ghc-init to ghc-mod-init and have an alias of ghc-init for backwards compatibility?