integrating flymake.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
SRCS = ghc.el ghc-func.el ghc-doc.el ghc-comp.el
|
||||
SRCS = ghc.el ghc-func.el ghc-doc.el ghc-comp.el ghc-flymake.el
|
||||
EMACS = emacs
|
||||
|
||||
|
||||
TEMPFILE = temp.el
|
||||
|
||||
all: $(TEMPFILE) ghc.el
|
||||
|
||||
@@ -66,8 +66,7 @@
|
||||
(lambda ()
|
||||
(let ((msg (mapconcat 'identity (cons ghc-module-command args) " ")))
|
||||
(message "Executing \"%s\"..." msg)
|
||||
(apply 'call-process-shell-command
|
||||
ghc-module-command nil t nil (cons "-l" args))
|
||||
(apply 'call-process ghc-module-command nil t nil (cons "-l" args))
|
||||
(message "Executing \"%s\"...done" msg))))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
23
elisp/ghc-flymake.el
Normal file
23
elisp/ghc-flymake.el
Normal file
@@ -0,0 +1,23 @@
|
||||
(require 'flymake)
|
||||
|
||||
(defvar ghc-flymake-allowed-file-name-masks
|
||||
'("\\.l?hs$" ghc-flymake-init flymake-simple-cleanup flymake-get-real-file-name))
|
||||
|
||||
(defvar ghc-flymake-err-line-patterns
|
||||
'("^\\(.*\\.l?hs\\):\\([0-9]+\\):\\([0-9]+\\):\\(.+\\)" 1 2 3 4))
|
||||
|
||||
(add-to-list 'flymake-allowed-file-name-masks
|
||||
ghc-flymake-allowed-file-name-masks)
|
||||
|
||||
(add-to-list 'flymake-err-line-patterns
|
||||
ghc-flymake-err-line-patterns)
|
||||
|
||||
(defun ghc-flymake-init ()
|
||||
(let* ((temp-file (flymake-init-create-temp-buffer-copy
|
||||
'flymake-create-temp-inplace))
|
||||
(local-file (file-relative-name
|
||||
temp-file
|
||||
(file-name-directory buffer-file-name))))
|
||||
(list "ghc-mod" (list "check" local-file))))
|
||||
|
||||
(provide 'ghc-flymake)
|
||||
17
elisp/ghc.el
17
elisp/ghc.el
@@ -14,11 +14,14 @@
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar ghc-version "0.1")
|
||||
(defvar ghc-version "0.2.0")
|
||||
|
||||
;; (eval-when-compile
|
||||
;; (require 'haskell-mode))
|
||||
|
||||
;; (require 'haskell-mode)
|
||||
(require 'ghc-comp)
|
||||
(require 'ghc-doc)
|
||||
(require 'ghc-flymake)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;
|
||||
@@ -28,6 +31,10 @@
|
||||
(defvar ghc-completion-key "\e\t")
|
||||
(defvar ghc-document-key "\e\C-d")
|
||||
(defvar ghc-import-key "\e\C-m")
|
||||
(defvar ghc-check-key "\e\C-c")
|
||||
(defvar ghc-previous-key "\e\C-p")
|
||||
(defvar ghc-next-key "\e\C-n")
|
||||
(defvar ghc-help-key "\e?")
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;
|
||||
@@ -41,5 +48,11 @@
|
||||
(define-key haskell-mode-map ghc-completion-key 'ghc-complete)
|
||||
(define-key haskell-mode-map ghc-document-key 'ghc-browse-document)
|
||||
(define-key haskell-mode-map ghc-import-key 'ghc-load-module-buffer)
|
||||
(define-key haskell-mode-map ghc-check-key 'flymake-start-syntax-check)
|
||||
(define-key haskell-mode-map ghc-previous-key 'flymake-goto-prev-error)
|
||||
(define-key haskell-mode-map ghc-next-key 'flymake-goto-next-error)
|
||||
(define-key haskell-mode-map ghc-help-key 'flymake-display-err-menu-for-current-line)
|
||||
(ghc-comp-init)
|
||||
(setq ghc-initialized t)))
|
||||
|
||||
(provide 'ghc)
|
||||
Reference in New Issue
Block a user