help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Flymake PHP Emacs


From: lampshade
Subject: Flymake PHP Emacs
Date: Thu, 3 Jan 2008 21:52:21 -0800 (PST)
User-agent: G2/1.0

Hello,

I've been trying to get flymake to work with PHP based off of a blog
post I saw here
http://www.blik.it/2007/02/21/syntax-checking-for-php-in-emacs/

But I've run into problems with it.  When I try to enable it, I
receive the error

Flymake: Configuration error has occured while running (php -l
myfile.php). Flymake will be switched OFF


Nothing else appears in the message buffer.

my .emacs looks like
(add-to-list 'load-path "~/.emacs.d/")
(load "~/.emacs.d/flymake.php.el")
(require 'flymake-php)
(add-hook 'php-mode-user-hook 'flymake-php-load)


;; Flymake PHP Extension

(require 'flymake)

(defconst flymake-allowed-php-file-name-masks '(
("\\.php3\\'" flymake-php-init)
("\\.inc\\'" flymake-php-init)
("\\.php\\'" flymake-php-init))
"Filename extensions that switch on flymake-php mode syntax checks")

(defconst flymake-php-err-line-pattern-re '("(Parse|Fatal) error: (.*)
in (.*) on line ([0-9]+)" 3 4 nil 2)
"Regexp matching PHP error messages")

(defun flymake-php-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
;;(list "php" (list "-f" local-file "-l"))))
(list "php" (list "-l" local-file))))

(defun flymake-php-load ()
(setq flymake-allowed-file-name-masks (append flymake-allowed-file-
name-masks flymake-allowed-php-file-name-masks))
(setq flymake-err-line-patterns (cons flymake-php-err-line-pattern-re
flymake-err-line-patterns))
(flymake-mode t)
(local-set-key "C-cd" 'flymake-display-err-menu-for-current-line))

(provide 'flymake-php)


Any ideas?


Thanks in advance,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]