僕のflymake-perl周りの設定晒し最終版(今現在)
(require 'flymake) (require 'set-perl5lib) (defadvice flymake-report-status (before flymake-quite-report-status (e-w &optional status)) (if (not e-w) (progn (flymake-mode 0) (flymake-log 0 "switched OFF Flymake mode due to unknown fatal status (maybe tramp is running)")))) (ad-activate 'flymake-report-status) ;; エラーをミニバッファに表示 ;; http://d.hatena.ne.jp/xcezx/20080314/1205475020 (defun credmp/flymake-display-err-minibuf () "Displays the error/warning for the current line in the minibuffer" (interactive) (let* ((line-no (flymake-current-line-no)) (line-err-info-list (nth 0 (flymake-find-err-info flymake-err-info line-no))) (count (length line-err-info-list))) (while (> count 0) (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))))) ;; エラー、ウォーニング時のフェイス ;; via http://d.hatena.ne.jp/antipop/20080701/1214838633 (set-face-background 'flymake-errline "red4") (set-face-foreground 'flymake-errline "black") (set-face-background 'flymake-warnline "yellow") (set-face-foreground 'flymake-warnline "black") ;; cperl-mode ;; もし何かあったら http://www.bookshelf.jp/soft/meadow_41.html#SEC608 へ ;; cperl-mode is preferred to perl-mode ;; "Brevity is the soul of wit" <foo at acm.org> (defalias 'perl-mode 'cperl-mode) ;; Perl用flymake設定 (push '("\\.pl$" flymake-perl-init) flymake-allowed-file-name-masks) (push '("\\.pm$" flymake-perl-init) flymake-allowed-file-name-masks) (push '("\\.t$" flymake-perl-init) flymake-allowed-file-name-masks) (push '("\\(.*\\) at \\([^ \n]+\\) line \\([0-9]+\\)[,.\n]" 2 3 nil 1) flymake-err-line-patterns) (add-hook 'cperl-mode-hook '(lambda () (defadvice flymake-post-syntax-check (before flymake-force-check-was-interrupted) (setq flymake-check-was-interrupted t)) (ad-activate 'flymake-post-syntax-check) (define-key cperl-mode-map "\C-cd" 'credmp/flymake-display-err-minibuf) (set-perl5lib) (flymake-mode)))
(追記)
うーん、実際にやると、エラーメッセージが表示されてどうなってるか分かりにくい…。(message-box "flymake-mode is off!!")とかはさんでおくと、実際に実行されてる(2回も!?)のが確認できるんですが。