diff --git a/.emacs.d/init.el b/.emacs.d/init.el index cb85a78..72dac28 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -158,6 +158,25 @@ (add-hook 'c-mode-common-hook 'oni/c-mode-common-hook) (add-hook 'c-mode-hook 'oni/c-mode-hook) +;;; Flymake +(require 'flymake) + +(defun flymake-php-init () + "Use php to check the syntax of the current file." + (let* ((temp (flymake-init-create-temp-buffer-copy + 'flymake-create-temp-inplace)) + (local (file-relative-name temp (file-name-directory + buffer-file-name)))) + (list "php" (list "-f" local "-l")))) + +(add-to-list + 'flymake-err-line-patterns + '("\\(Parse\\|Fatal\\) error: +\\(.*?\\) in \\(.*?\\) on line \\([0-9]+\\)$" + 3 4 nil 2)) + +(add-to-list 'flymake-allowed-file-name-masks + '("\\.php$" flymake-php-init)) + ;;; PHP mode (defun oni/php-show-outline () (interactive) @@ -168,7 +187,10 @@ (c-set-offset 'arglist-close '0) (local-set-key [f6] 'comment-line) (local-set-key [f7] 'oni/php-show-outline) - (set-column-markers 76 81)) + (local-set-key [M-S-up] 'flymake-goto-prev-error) + (local-set-key [M-S-down] 'flymake-goto-next-error) + (set-column-markers 76 81) + (flymake-mode 1)) (autoload 'php-mode "php-mode" "Major mode for PHP" t) (setq-default php-mode-warn-if-mumamo-off nil) ; don't warn me about this