diff options
Diffstat (limited to 'prog/jao-cabal.el')
-rw-r--r-- | prog/jao-cabal.el | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/prog/jao-cabal.el b/prog/jao-cabal.el new file mode 100644 index 0000000..699fa1b --- /dev/null +++ b/prog/jao-cabal.el @@ -0,0 +1,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 build")))) + +(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) |