Created
October 3, 2011 18:42
-
-
Save kapilreddy/1259881 to your computer and use it in GitHub Desktop.
php config for emacs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)) | |
(require 'php-mode) | |
(add-hook 'php-mode-hook (lambda () (flymake-mode 1))) | |
(define-key php-mode-map '[M-S-up] 'flymake-goto-prev-error) | |
(define-key php-mode-map '[M-S-down] 'flymake-goto-next-error) | |
(require 'multi-web-mode) | |
(setq mweb-default-major-mode 'html-mode) | |
(setq mweb-tags '((php-mode "<\\?php\\|<\\? \\|<\\?=" "\\?>") | |
(espresso-mode "<script +\\(type=\"text/javascript\"\\|language=\"javascript\"\\)[^>]*>" "</script>") | |
(css-mode "<style +type=\"text/css\"[^>]*>" "</style>"))) | |
(setq mweb-filename-extensions '("php" "htm" "html" "ctp" "phtml" "php4" "php5")) | |
(multi-web-global-mode 1) | |
(provide 'php-config) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment