Created
November 28, 2012 19:28
-
-
Save zwass/4163491 to your computer and use it in GitHub Desktop.
Haskell config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;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