From 65576411c41dd02a413e65fd14b5cd135b3de228 Mon Sep 17 00:00:00 2001 From: Chris Barrett Date: Thu, 16 Apr 2015 20:03:53 +1200 Subject: [PATCH] haskell fixes - ensure haskell-indentation is loaded before calling members - fix misspelled references to keymaps - fix function names - s/identation/indentation --- contrib/lang/haskell/packages.el | 56 +++++++++++++++++--------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/contrib/lang/haskell/packages.el b/contrib/lang/haskell/packages.el index 5de328b53..d46e4bc27 100644 --- a/contrib/lang/haskell/packages.el +++ b/contrib/lang/haskell/packages.el @@ -43,9 +43,9 @@ :init (add-hook 'haskell-mode-hook 'ghc-init) :config (when (configuration-layer/package-usedp 'flycheck) - ;; remove overlays from ghc-check.el if flycheck is enabled - (set-face-attribute 'ghc-face-error nil :underline nil) - (set-face-attribute 'ghc-face-warn nil :underline nil)))) + ;; remove overlays from ghc-check.el if flycheck is enabled + (set-face-attribute 'ghc-face-error nil :underline nil) + (set-face-attribute 'ghc-face-warn nil :underline nil)))) (defun haskell/init-haskell-mode () (require 'haskell-yas) @@ -92,25 +92,6 @@ ;; Disable haskell-stylish on save, it breaks flycheck highlighting haskell-stylish-on-save nil) - ;; Show indentation guides in insert or emacs state only. - (defun spacemacs//haskell-identation-show-guides () - "Show the indent guides." - (when (eq 'haskell-mode major-mode) - (funcall 'haskell-indentation-enable-show-indentations))) - (defun spacemacs//haskell-identation-hide-guides () - "Hide the indent guides." - (when (eq 'haskell-mode major-mode) - (funcall 'haskell-indentation-disable-show-indentations))) - ;; first entry in normal state - (add-hook 'evil-normal-state-entry-hook - 'spacemacs//haskell-identation-hide-guides) - (dolist (state '(insert emacs)) - (eval `(progn - (add-hook ',(intern (format "evil-%S-state-entry-hook" state)) - 'spacemacs//haskell-identation-show-guides) - (add-hook ',(intern (format "evil-%S-state-exit-hook" state)) - 'spacemacs//haskell-identation-hide-guides)))) - ;; key bindings (defun spacemacs/haskell-process-do-type-on-prev-line () (interactive) @@ -147,7 +128,7 @@ "mdr" 'haskell-debug/refresh) ;; Switch back to editor from REPL - (evil-leader/set-key-for-mode 'interactive-haskell-mode + (evil-leader/set-key-for-mode 'haskell-interactive-mode "msS" 'haskell-interactive-switch) ;; Compile @@ -178,7 +159,30 @@ ;; Useful to have these keybindings for .cabal files, too. (eval-after-load 'haskell-cabal-mode-map '(define-key haskell-cabal-mode-map - [?\C-c ?\C-z] 'haskell-interactive-switch))))) + [?\C-c ?\C-z] 'haskell-interactive-switch)))) + + (use-package haskell-indentation + :defer t + :config + (progn + ;; Show indentation guides in insert or emacs state only. + (defun spacemacs//haskell-indentation-show-guides () + "Show visual indentation guides." + (when (derived-mode-p 'haskell-mode) + (haskell-indentation-enable-show-indentations))) + + (defun spacemacs//haskell-indentation-hide-guides () + "Hide visual indentation guides." + (when (derived-mode-p 'haskell-mode) + (haskell-indentation-disable-show-indentations))) + + ;; first entry in normal state + (add-hook 'evil-normal-state-entry-hook 'spacemacs//haskell-indentation-hide-guides) + + (add-hook 'evil-insert-state-entry-hook 'spacemacs//haskell-indentation-show-guides) + (add-hook 'evil-emacs-state-entry-hook 'spacemacs//haskell-indentation-show-guides) + (add-hook 'evil-insert-state-exit-hook 'spacemacs//haskell-indentation-hide-guides) + (add-hook 'evil-emacs-state-exit-hook 'spacemacs//haskell-indentation-hide-guides)))) (defun haskell/init-hindent () (use-package hindent @@ -217,11 +221,11 @@ (kbd "M-RET") 'evil-ret ) - (evil-define-key 'operator map + (evil-define-key 'operator shm-map (kbd ")") 'shm/forward-node (kbd "(") 'shm/backward-node) - (evil-define-key 'motion map + (evil-define-key 'motion shm-map (kbd ")") 'shm/forward-node (kbd "(") 'shm/backward-node)