Flymake-mode for Haskell (Emacs) without perl script
コンテンツ
前の
Flymake-mode for Haskell (Emacs) – 落書き、時々落学
ではperlスクリプトが必要だった.
しかし,それがなくても,大丈夫であることが分かった.
目次
参考
環境
- Ubuntu 9.04
- emacs 23.0.91.1
- flymake 0.3
- ghc 6.8.2
.emacsの編集
以下のようにすればOKだった.
;====================================================================== ; flymake-mode for haskell ;====================================================================== (require 'flymake) (defun flymake-Haskell-init () (flymake-simple-make-init-impl 'flymake-create-temp-with-folder-structure nil nil (file-name-nondirectory buffer-file-name) 'flymake-get-Haskell-cmdline)) (defun flymake-get-Haskell-cmdline (source base-dir) (list "ghc" (list "--make" "-fbyte-code" (concat "-i"base-dir) source))) (defvar multiline-flymake-mode nil) (defvar flymake-split-output-multiline nil) (defadvice flymake-split-output (around flymake-split-output-multiline activate protect) (if multiline-flymake-mode (let ((flymake-split-output-multiline t)) ad-do-it) ad-do-it)) (defadvice flymake-split-string (before flymake-split-string-multiline activate) (when flymake-split-output-multiline (ad-set-arg 1 "^s *$"))) (add-hook 'haskell-mode-hook '(lambda () (add-to-list 'flymake-allowed-file-name-masks '(".l?hs$" flymake-Haskell-init flymake-simple-java-cleanup)) (add-to-list 'flymake-err-line-patterns '("^(.+.l?hs):([0-9]+):([0-9]+):((?:.|W)+)" 1 2 3 4)) (set (make-local-variable 'multiline-flymake-mode) t) (if (not (null buffer-file-name)) (flymake-mode)) )) ;; Display messages at the minibuffer (global-set-key "C-cd" 'flymake-show-and-sit ) (defun flymake-show-and-sit () "Displays the error/warning for the current line in the minibuffer" (interactive) (progn (let* ( (line-no (flymake-current-line-no) ) (line-err-info-list (nth (flymake-find-err-info flymake-err-info line-no))) (count (length line-err-info-list)) ) (while (> count ) (when line-err-info-list (let* ((file (flymake-ler-file (nth (1- count) line-err-info-list))) (full-file (flymake-ler-full-file (nth (1- count) line-err-info-list))) (text (flymake-ler-text (nth (1- count) line-err-info-list))) (line (flymake-ler-line (nth (1- count) line-err-info-list)))) (message "[%s] %s" line text) ) ) (setq count (1- count))))) (sit-for 60.0) ) ;;
作成者 Toru Mano
最終更新時刻 2023-01-01 (c70d5a1)