From d54e1ae4c71a0e99a1df3a7a22526228c58d0bcc Mon Sep 17 00:00:00 2001 From: Chris Barrett Date: Wed, 31 Dec 2014 12:21:48 +1300 Subject: [PATCH] Configure hi2 Resolves #356 --- contrib/lang/haskell/funcs.el | 7 +++++++ contrib/lang/haskell/packages.el | 14 ++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 contrib/lang/haskell/funcs.el diff --git a/contrib/lang/haskell/funcs.el b/contrib/lang/haskell/funcs.el new file mode 100644 index 000000000..3b3d9f3c5 --- /dev/null +++ b/contrib/lang/haskell/funcs.el @@ -0,0 +1,7 @@ +(defun spacemacs/haskell-show-hi2-guides () + (when (and (boundp 'hi2-mode) hi2-mode) + (hi2-enable-show-indentations))) + +(defun spacemacs/haskell-hide-hi2-guides () + (when (and (boundp 'hi2-mode) hi2-mode) + (hi2-disable-show-indentations))) diff --git a/contrib/lang/haskell/packages.el b/contrib/lang/haskell/packages.el index ca0c99537..6e68835d1 100644 --- a/contrib/lang/haskell/packages.el +++ b/contrib/lang/haskell/packages.el @@ -4,6 +4,7 @@ flycheck-haskell ghc haskell-mode + hi2 )) ;; Only load company-ghc if company-mode is enabled @@ -153,3 +154,16 @@ (add-to-list 'company-backends 'company-ghc) (ghc-comp-init) )) + +(defun haskell/init-hi2 () + (use-package hi2 + :diminish hi2-mode + :commands turn-on-hi2 + :init + (add-hook 'haskell-mode-hook 'turn-on-hi2) + :config + (progn + ;; Show indentation guides for hi2 only in insert state. + (add-hook 'evil-normal-state-entry-hook 'spacemacs/haskell-hide-hi2-guides) + (add-hook 'evil-insert-state-entry-hook 'spacemacs/haskell-show-hi2-guides) + (add-hook 'evil-insert-state-exit-hook 'spacemacs/haskell-hide-hi2-guides))))