Skip to content

Instantly share code, notes, and snippets.

@zwass
Created November 28, 2012 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zwass/4163491 to your computer and use it in GitHub Desktop.
Save zwass/4163491 to your computer and use it in GitHub Desktop.
Haskell config
;;Haskell setup
(defun haskell-custom-setup ()
(progn
(define-key haskell-mode-map (kbd "C-x C-s") 'haskell-mode-save-buffer)
(setq haskell-indent-offset 2)
(ghc-init)
(flymake-mode 1)
(defun haskell-mode-stylish-buffer-custom ()
"Apply stylish-haskell to the current buffer."
(interactive)
(let ((column (current-column))
(line (line-number-at-pos))
(buffer (current-buffer))
(file (buffer-file-name))
(end (buffer-size)))
(save-buffer) ;;First save so we don't lose the changes
;; (shell-command ;;Now run stylish with our custom config
;; (concat
;; "stylish-haskell -c ~/.emacs.d/stylish-haskell-config.yaml " file)
;; buffer
;; "*stylish_haskell_error*")
;; (mark-whole-buffer)
;; (haskell-indent-align-guards-and-rhs 0 end) ;;Align function stuff
;; (goto-line line)
;; (goto-char (+ column (point)))
))
(defadvice haskell-mode-save-buffer (before
haskell-mode-stylish-before-save
activate)
(haskell-mode-stylish-buffer-custom))
))
(remove-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
(add-hook 'haskell-mode-hook 'haskell-custom-setup)
;;(setq haskell-stylish-on-save t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment