[added Liam's emacs mode chr.maeder@web.de**20100414112327 Ignore-this: 896dfd327c7e4ac55773a1f1234ed1b4 ] adddir ./contrib addfile ./contrib/hs-scan.el hunk ./contrib/hs-scan.el 1 +;;; hs-scan.el --- minor mode for checking Haskell source code using +;;; the scan tool. + +;; Author: Liam O'Reilly +;; Keywords: haskell, scan +;; Requirements: scan +;; Status: distributed under terms of ??? + +;;; This has been heavily adapted from hs-lint.el by Alex Ott +;;; + +;; DELETE FROM HERE + +;; Orginal Licence + +;; Copyright 2009 (C) Alex Ott +;; +;; Author: Alex Ott +;; Keywords: haskell, lint, HLint +;; Requirements: +;; Status: distributed under terms of GPL2 or above + +;; DELETE UNTIL HERE + +(require 'compile) + +(defgroup hs-scan nil + "Run scan as inferior of Emacs, parse error messages." + :group 'tools + :group 'haskell) + +(defcustom hs-scan-command "scan" + "The default hs-scan command for \\[hs-scan]." + :type 'string + :group 'hs-scan) + +(defcustom hs-scan-save-files t + "Save modified files when run hs-scan or no (ask user)" + :type 'boolean + :group 'hs-scan) + +(defun hs-scan-process-setup () + "Setup compilation variables and buffer for `hs-scan'." + (run-hooks 'hs-scan-setup-hook)) + +(defun hs-scan-finish-hook (buf msg) + "Function, that is executed at the end of hs-scan execution" + (next-error 1 t)) + +(define-compilation-mode hs-scan-mode "hs-scan" + "Mode for checking Haskell source code with scan." + (set (make-local-variable 'compilation-process-setup-function) + 'hs-scan-process-setup) + (set (make-local-variable 'compilation-disable-input) t) + (set (make-local-variable 'compilation-scroll-output) nil) + (set (make-local-variable 'compilation-finish-functions) + (list 'hs-scan-finish-hook)) + ) + +(defun hs-scan () + "Run scan for current buffer with haskell source" + (interactive) + (save-some-buffers hs-scan-save-files) + (compilation-start (concat hs-scan-command " " buffer-file-name) + 'hs-scan-mode)) + +(provide 'hs-scan) +;;; hs-scan.el ends here hunk ./doc/index.html 59 +

Emacs integration

+The emacs integration is similar to compilation-mode in conjunction with the +haskell emacs mode. It is an adaption of +hs-lint.el +called hs-scan.el. +It allows navigation +between messages using M-g n and M-g p (or M-g M-n +and M-g M-p) or by clicking on a position in the *hs-scan* +buffer. A possible entry for your .emacs may contain the following +snippet: + +
+(load "~/emacs-modes/haskell-mode/haskell-site-file")
+(load-file "~/emacs-modes/hs-scan.el")
+(defun my-haskell-mode-hook ()
+ (global-set-key [f7] 'hs-scan))
+(add-hook 'haskell-mode-hook 'my-haskell-mode-hook)
+
+