I decided to give NXHTML mode a try with some of my own code and update this blog. It wasn't so terribly exciting, since this blog's code is just pure PHP with no free blocks of HTML, but it at least worked fine.
What was really cool to use is another Emacs feature I stumbled upon while configuring NXHTML: FlyMake. Flymake runs my code through PHP in real time and checks it for errors, highlighting lines that cause PHP errors right away.
Granted, it is a *tad* annoying to have lines in red while constructing them, but the tradeoff is worth it. No more silly forgot-the-parenthesis-or-semicolon errors, which (sad to say) used to collectively take a toll on my development time.
FlyMake had apparently been installed in Emacs by default, so I've had it for the last year or two that I've been using Emacs; but I had to add a bunch of stuff to .emacs to enable it. I added the following:
****************************
;;flymake for php
(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 '("\\.module$" flymake-php-init))
(add-to-list 'flymake-allowed-file-name-masks '("\\.install$" flymake-php-init))
(add-to-list 'flymake-allowed-file-name-masks '("\\.inc$" flymake-php-init))
(add-to-list 'flymake-allowed-file-name-masks '("\\.engine$" flymake-php-init))
(add-hook 'find-file-hook 'flymake-mode)
**********************************
Copied from a blog somewhere, so feel free to copy from mine.
Comments: