- ;; todo haskell mode better binds for:
- ;; 'haskell-process-load-file
- ;; 'haskell-process-do-type
- ;; 'haskell-process-do-info
- ;; 'inferior-haskell-send-decl
-
-
- ;; commands which don't work in haskell-interactive-mode(hi) vs inferior-haskell-mode(ih, default)
- ;; functions not in hi:
- ;; inferior-haskell-find-definition, use tags instead
- ;; inferior-haskell-find-haddock, todo, test if this works
-
- ;; redefined ih to hi
- ;; switch-to-haskell -> 'haskell-interactive-switch
- ;; haskell-process-load-file -> inferior-haskell-load-file
- ;; haskell-process-do-type -> inferior-haskell-type
- ;; switch-to-haskell -> haskell-interactive-switch
- ;; inferior-haskell-load-file -> 'haskell-process-load-file
-
-
- ;; haskell-mode installation from source, based on its readme
- ;; in the git directory,
- ;; make all
-
-
-
-
- ;; remove default option to not link the file
- (setq haskell-compile-command "ghc -Wall -ferror-spans -fforce-recomp %s")
- (add-hook 'haskell-indentation-mode-hook
- (lambda ()
- (define-key haskell-indentation-mode-map [?\C-d] nil)
- (define-key haskell-indentation-mode-map
- (kbd "<deletechar>")
- 'haskell-indentation-delete-char)))
-
- ;;copied from haskell-mode docs in order to use the new, better, nondefault
- ;;interactive mode.
- (eval-after-load "haskell-mode"
- '(progn
- (define-key haskell-mode-map (kbd "C-x C-d") nil)
- (define-key haskell-mode-map (kbd "C-c C-z") 'haskell-interactive-switch)
- (define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-file)
- (define-key haskell-mode-map (kbd "C-c C-b") 'haskell-interactive-switch)
- (define-key haskell-mode-map (kbd "C-c C-t") 'haskell-process-do-type)
- (define-key haskell-mode-map (kbd "C-c C-i") 'haskell-process-do-info)
- (define-key haskell-mode-map (kbd "C-c M-.") nil)
- (define-key haskell-mode-map (kbd "C-c C-d") nil)))
-
- ;; ghc-mod install http://www.mew.org/~kazu/proj/ghc-mod/en/emacs.html
- ;; todo, try this out
- ;; (autoload 'ghc-init "ghc" nil t)
- ;;(add-hook 'haskell-mode-hook (lambda () (ghc-init) (flymake-mode)))
-
-
-
- ;; from the package readme for ghci-completion
- (add-hook 'inferior-haskell-mode-hook 'turn-on-ghci-completion)
-
-
- ;; disable some rebinds. they are set to appropriate keys in the keybinds section
- (eval-after-load "haskell-mode"
- '(progn
- (define-key haskell-mode-map (kbd "C-a") 'nil)
- (define-key haskell-mode-map (kbd "C-j") 'nil)))
-
- (eval-after-load "python-mode"
- '(progn
- (define-key python-mode-map (kbd "C-j") nil)))
-
- (defun pretty-lambdas-haskell ()
- (font-lock-add-keywords
- nil `((,(concat "(?\\(" (regexp-quote "\\") "\\)")
- (0 (progn (compose-region (match-beginning 1) (match-end 1)
- ,(make-char 'greek-iso8859-7 107))
- nil))))))
- ;; from haskell-mode manual
- (add-hook 'haskell-mode-hook 'turn-on-haskell-decl-scan)
- (when (window-system)
- (add-hook 'haskell-mode-hook 'pretty-lambdas-haskell))
-
- ;; added from haskell-mode website install instructions
- ;(load "/usr/share/emacs/site-lisp/haskell-mode/haskell-site-file")
- (add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
- ;;the three indentation modules are mutually exclusive - add at most one. Trying out the "most advanced"
- (add-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-simple-indent)
-
-
- ;; todo, set this to some other key
- ;; (local-set-key (kbd "C-e") 'my-haskell-load-and-run)
-
- (defun my-haskell-load-and-run ()
- "Loads and runs the current Haskell file."
- (interactive)
- (let ((start-buffer (current-buffer)))
- (inferior-haskell-load-and-run inferior-haskell-run-command)
- (sleep-for 0 100)
- (end-of-buffer)
- (pop-to-buffer start-buffer)))
-
- ;; show haskell function in mode line
- ;; todo, this broke after updating emacs
- ;;(eval-after-load "which-func"
- ;; '(add-to-list 'which-func-modes 'haskell-mode))
-
-
-
- (add-hook 'interactive-haskell-mode-hook 'ac-haskell-process-setup)
- (add-hook 'haskell-interactive-mode-hook 'ac-haskell-process-setup)
- (eval-after-load "auto-complete"
- '(add-to-list 'ac-modes 'haskell-interactive-mode))
-
- (add-hook 'haskell-mode-hook
- (lambda () (define-key haskell-mode-map (kbd "C-(")
- (lambda () (interactive)
- (basic-save-buffer)
- (haskell-compile)
- (run-with-timer .3 nil 'repeat-shell)))))
- (add-hook 'haskell-cabal-mode-hook
- (lambda () (define-key haskell-cabal-mode-map (kbd "C-(") 'haskell-compile)))
-
-
-
- (add-hook 'haskell-interactive-mode-hook
- (lambda ()
- (define-key haskell-interactive-mode-map "\r" nil)
- (define-key haskell-interactive-mode-map (kbd "<return>") 'haskell-interactive-mode-return)))
- (add-hook 'haskell-indentation-mode-hook (lambda () (define-key haskell-indentation-mode-map "\r" nil)))
-
-
-
- (add-hook 'haskell-interactive-mode-hook
- (lambda ()
- (define-key haskell-interactive-mode-map (kbd "<C-M-return>") 'haskell-interactive-mode-newline-indent)))