Added initial support for structured-haskell-mode
This commit is contained in:
parent
1b7777be36
commit
14c1852f34
|
@ -11,7 +11,9 @@
|
|||
- [Layer](#layer)
|
||||
- [Cabal packages](#cabal-packages)
|
||||
- [OS X](#os-x)
|
||||
- [Enabling GHCi-ng support](#enabling-ghci-ng-support)
|
||||
- [Optional extras](#optional-extras)
|
||||
- [GHCi-ng support](#ghci-ng-support)
|
||||
- [structured-haskell-mode](#structured-haskell-mode)
|
||||
- [Key bindings](#key-bindings)
|
||||
- [Haskell source code:](#haskell-source-code)
|
||||
- [Haskell commands:](#haskell-commands)
|
||||
|
@ -23,6 +25,7 @@
|
|||
|
||||
<!-- markdown-toc end -->
|
||||
|
||||
|
||||
## Description
|
||||
|
||||
This layer adds support for the [Haskell][] language.
|
||||
|
@ -84,7 +87,10 @@ so that the path is added before any layers is loaded.
|
|||
Note that `emacs.app` for OS X does not pick up `$PATH` from `~/.bashrc` or
|
||||
`~/.zshrc` when launched from outside a terminal.
|
||||
|
||||
### Enabling GHCi-ng support
|
||||
### Optional extras
|
||||
The Haskell layer supports some extra features that can be enabled through layer variables.
|
||||
|
||||
#### GHCi-ng support
|
||||
[ghci-ng][] adds some nice features to `haskell-mode`, and is supported in Spacemacs by a layer variable:
|
||||
|
||||
Follow the instructions to install [ghci-ng][] (remember to add `:set +c` in `~/.ghci`,
|
||||
|
@ -102,6 +108,14 @@ Once ghci-ng is enabled, two of the old keybindings are overriden with improved
|
|||
<kbd>SPC m g g</kbd> | go to definition
|
||||
<kbd>SPC m u</kbd> | finds uses of identifier
|
||||
|
||||
#### structured-haskell-mode
|
||||
[structured-haskell-mode][], or shm, replaces hi2 and adds some nice functionality.
|
||||
To enable shm, run `cabal install structured-haskell-mode` and set the layer variable:
|
||||
```elisp
|
||||
;; List of configuration layers to load.
|
||||
dotspacemacs-configuration-layers '(company-mode (haskell :variables haskell-shm-support t) git)
|
||||
```
|
||||
|
||||
## Key bindings
|
||||
|
||||
All Haskell specific bindings are prefixed with <kbd>SPC m</kbd>
|
||||
|
@ -183,3 +197,4 @@ REPL commands are prefixed by <kbd>SPC m s</kbd>:
|
|||
[company-ghc]: https://github.com/iquiw/company-ghc
|
||||
[hi2]: https://github.com/nilcons/hi2
|
||||
[ghci-ng]: https://github.com/chrisdone/ghci-ng
|
||||
[structured-haskell-mode]: https://github.com/chrisdone/structured-haskell-mode
|
||||
|
|
|
@ -11,4 +11,7 @@
|
|||
|
||||
;; Variables
|
||||
(defvar haskell-ghci-ng-support nil
|
||||
"If non nil ghci-ng support is enabled")
|
||||
"If non-nil ghci-ng support is enabled")
|
||||
|
||||
(defvar haskell-shm-support nil
|
||||
"If non-nil structured-haskell-mode support is enabled")
|
||||
|
|
|
@ -18,12 +18,25 @@
|
|||
ghc
|
||||
haskell-mode
|
||||
hi2
|
||||
shm
|
||||
))
|
||||
|
||||
(defun haskell/init-flycheck ()
|
||||
;;(add-hook 'haskell-mode-hook 'flycheck-mode))
|
||||
(add-hook 'flycheck-mode-hook 'flycheck-haskell-setup))
|
||||
|
||||
(defun haskell/init-shm ()
|
||||
(use-package shm
|
||||
:defer t
|
||||
:if haskell-shm-support
|
||||
:init
|
||||
(add-hook 'haskell-mode-hook 'structured-haskell-mode)
|
||||
:config
|
||||
(progn
|
||||
|
||||
)))
|
||||
|
||||
|
||||
(defun haskell/init-haskell-mode ()
|
||||
(require 'haskell-yas)
|
||||
(use-package haskell-mode
|
||||
|
@ -139,7 +152,9 @@
|
|||
(defun haskell-hook ()
|
||||
(ghc-init)
|
||||
;; Use advanced indention
|
||||
(turn-on-haskell-indentation)
|
||||
(if (not haskell-shm-support)
|
||||
(turn-on-haskell-indentation)
|
||||
)
|
||||
|
||||
;; Indent the below lines on columns after the current column.
|
||||
;; Might need better bindings for spacemacs and OS X
|
||||
|
@ -188,6 +203,7 @@
|
|||
(use-package hi2
|
||||
:diminish hi2-mode
|
||||
:commands turn-on-hi2
|
||||
:if (not haskell-shm-support)
|
||||
:init
|
||||
(add-hook 'haskell-mode-hook 'turn-on-hi2)
|
||||
:config
|
||||
|
|
Loading…
Reference in a new issue