Skip to content

Instantly share code, notes, and snippets.

@ieure
Created July 22, 2009 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ieure/152194 to your computer and use it in GitHub Desktop.
Save ieure/152194 to your computer and use it in GitHub Desktop.
(defun php-lint ()
"Performs a PHP lint-check on the current file."
(interactive)
(require 'compile)
(let* ((compilation-error-regexp-alist '(php))
(compilation-error-regexp-alist-alist ())
(tramp (tramp-tramp-file-p (buffer-file-name)))
(file (or (and tramp
(aref (tramp-dissect-file-name (buffer-file-name)) 3))
(buffer-file-name))))
(pushnew '(php "\\(syntax error.*\\) in \\(.*\\) on line \\([0-9]+\\)$" 2 3 nil nil 1)
compilation-error-regexp-alist-alist)
(compile (concat "php -l -f \"" file "\""))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment