From e847ed6dab04910fa48f9bd02bb1e2400922885d Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Fri, 23 Apr 2010 18:38:11 +0900 Subject: [PATCH] C-xC-s now checks syntax even if not modified. --- elisp/ghc-command.el | 6 ++++++ elisp/ghc.el | 2 ++ 2 files changed, 8 insertions(+) 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)))