diff --git a/elisp/ghc-command.el b/elisp/ghc-command.el index 6cbab81..8ffa01b 100644 --- a/elisp/ghc-command.el +++ b/elisp/ghc-command.el @@ -49,4 +49,10 @@ nil) 'end-of-line))))) +(defun ghc-save-buffer () + (interactive) + (if (buffer-modified-p) + (save-buffer) + (flymake-start-syntax-check))) + (provide 'ghc-command) diff --git a/elisp/ghc.el b/elisp/ghc.el index c009204..64f439c 100644 --- a/elisp/ghc.el +++ b/elisp/ghc.el @@ -40,6 +40,7 @@ (defvar ghc-help-key "\e?") (defvar ghc-insert-key "\et") (defvar ghc-sort-key "\es") +(defvar ghc-check-key "\C-x\C-s") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; @@ -59,6 +60,7 @@ (define-key haskell-mode-map ghc-help-key 'ghc-display-errors) (define-key haskell-mode-map ghc-insert-key 'ghc-insert-template) (define-key haskell-mode-map ghc-sort-key 'ghc-sort-lines) + (define-key haskell-mode-map ghc-check-key 'ghc-save-buffer) (ghc-comp-init) (setq ghc-initialized t)))