doomemacs/modules/lang/haskell/+intero.el
Henrik Lissner fd19698927
doom|hack-local-variables => MODE-local-vars-hook
Uses a less destructive method (the same that Spacemacs uses) than the
one introduced in 13cee68, by introducing MODE-local-vars-hook hooks,
which run after local vars have been initialized.

The old method was to call `hack-local-variables` *before* mode hooks
run, however, this causes variables set by modes to have higher
precedence than local vars, which is unacceptable.

Also moved intero-mode & dante-mode to haskell-mode-local-vars-hook
2018-09-29 15:01:35 -04:00

27 lines
1 KiB
EmacsLisp

;;; lang/haskell/+intero.el -*- lexical-binding: t; -*-
;;;###if (featurep! +intero)
(def-package! intero
:commands intero-mode
:init
(defun +haskell|init-intero ()
"Initializes `intero-mode' in haskell-mode, unless stack isn't installed.
This is necessary because `intero-mode' doesn't do its own error checks."
(when (derived-mode-p 'haskell-mode)
(if (executable-find "stack")
(intero-mode +1)
(message "Couldn't find stack. Refusing to enable intero-mode."))))
(add-hook 'haskell-mode-local-vars-hook #'+haskell|init-intero)
:config
(setq haskell-compile-cabal-build-command "stack build --fast")
(set-lookup-handlers! 'intero-mode :definition #'intero-goto-definition)
(when (featurep! :feature syntax-checker)
(flycheck-add-next-checker 'intero '(warning . haskell-hlint)))
(map! :map intero-mode-map
:localleader
:n "t" #'intero-type-at
:n "i" #'intero-info
:n "l" #'intero-repl-load
:nv "e" #'intero-repl-eval-region
:n "a" #'intero-apply-suggestions))