added flymake and configured it to report php (and drupal) syntax errors. Customized the flymake-error-face to be red on magenta background.
This commit is contained in:
parent
ca732de852
commit
6adf61ba05
File diff suppressed because it is too large
Load Diff
36
init.el
36
init.el
|
@ -50,3 +50,39 @@
|
||||||
(add-hook 'drupal-mode-hook 'my-drupal-hook-function)
|
(add-hook 'drupal-mode-hook 'my-drupal-hook-function)
|
||||||
(autoload 'js2-mode "js2-mode" nil t)
|
(autoload 'js2-mode "js2-mode" nil t)
|
||||||
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
|
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
|
||||||
|
;; Synax checking for PHP with flymake
|
||||||
|
;; http://sachachua.com/blog/2008/07/emacs-and-php-on-the-fly-syntax-checking-with-flymake/
|
||||||
|
;; https://github.com/illusori/emacs-flymake
|
||||||
|
;; http://www.emacswiki.org/emacs/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))
|
||||||
|
;; Drupal-type extensions
|
||||||
|
(add-to-list 'flymake-allowed-file-name-masks
|
||||||
|
'("\\.\\(inc\\|module\\|test\\|install\\|theme\\)$"
|
||||||
|
flymake-php-init))
|
||||||
|
(add-hook 'php-mode-hook (lambda () (flymake-mode 1)))
|
||||||
|
(add-hook 'php-mode-hook (lambda ()
|
||||||
|
(define-key php-mode-map '[M-S-up]
|
||||||
|
'flymake-goto-prev-error)))
|
||||||
|
(add-hook 'php-mode-hook (lambda ()
|
||||||
|
(define-key php-mode-map '[M-S-down]
|
||||||
|
'flymake-goto-next-error)))
|
||||||
|
(custom-set-variables
|
||||||
|
;; custom-set-variables was added by Custom.
|
||||||
|
;; If you edit it by hand, you could mess it up, so be careful.
|
||||||
|
;; Your init file should contain only one such instance.
|
||||||
|
;; If there is more than one, they won't work right.
|
||||||
|
)
|
||||||
|
(custom-set-faces
|
||||||
|
;; custom-set-faces was added by Custom.
|
||||||
|
;; If you edit it by hand, you could mess it up, so be careful.
|
||||||
|
;; Your init file should contain only one such instance.
|
||||||
|
;; If there is more than one, they won't work right.
|
||||||
|
'(flymake-errline ((((class color) (background light)) (:background "magenta" :foreground "red")))))
|
||||||
|
|
Loading…
Reference in New Issue