-
Notifications
You must be signed in to change notification settings - Fork 2
/
flymake-php.el
39 lines (32 loc) · 1.13 KB
/
flymake-php.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
;;; flymake-php.el --- A flymake handler for php-mode files
;;
;;; Author: Steve Purcell <[email protected]>
;;; URL: https://github.com/purcell/flymake-php
;;; Version:
;;; Package-Requires: ((flymake-easy "0.1"))
;;;
;;; Commentary:
;; Usage:
;; (require 'flymake-php)
;; (add-hook 'php-mode-hook 'flymake-php-load)
;;
;; Uses flymake-easy, from https://github.com/purcell/flymake-easy
;;; Code:
(require 'flymake-easy)
(defconst flymake-php-err-line-patterns
'(("\\(?:Parse\\|Fatal\\|syntax\\) error[:,] \\(.*\\) in \\(.*\\) on line \\([0-9]+\\)" 2 3 nil 1)))
(defvar flymake-php-executable "php"
"The php executable to use for syntax checking.")
(defun flymake-php-command (filename)
"Construct a command that flymake can use to check php source."
(list flymake-php-executable "-l" "-f" filename))
;;;###autoload
(defun flymake-php-load ()
"Configure flymake mode to check the current buffer's php syntax."
(interactive)
(flymake-easy-load 'flymake-php-command
flymake-php-err-line-patterns
'tempdir
"php"))
(provide 'flymake-php)
;;; flymake-php.el ends here