summaryrefslogtreecommitdiffhomepage
path: root/prog/jao-cabal.el
blob: 5f5fd99b0be6f8f38ffba0f0347b1853f2d292b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
(require 'jao-dominating-file)

(defun jao-haskell-locate-cabal-file ()
  (jao-locate-dominating-file ".+\\.cabal"))

(eval-after-load 'haskell-mode
  '(add-hook 'haskell-mode-hook
             (lambda ()
               (set (make-local-variable 'compile-command) "cabal install"))))

(defun jao-haskell-cabal-build ()
  (interactive)
  (let ((cabal-file (jao-haskell-locate-cabal-file)))
    (unless cabal-file
      (error "Couldn't find associated cabal file"))
    (let ((default-directory (file-name-directory cabal-file)))
      (call-interactively 'compile))))

;;(eval-after-load 'haskell-mode
;;  '(define-key haskell-mode-map [?\C-c ?c] 'jao-haskell-cabal-build))

(provide 'jao-cabal)