Hacking on php-mode.el

It appears that php-mode for Emacs isn’t actively maintained any more. This is too bad, since I’m a PHP programmer who uses Emacs.

After waiting quite a while for a new version, I decided to take it upon myself to fix some of the problems I found instead.

  • Class constants have correct font locking, both when declared and when used.
  • The __CLASS__ constant is not highlighted as a class declaration anymore.
  • __FILE__, __LINE__, __CLASS__, and __FUNCTION__ are all correctly highlighted as constants.
  • Type-hinted variables passed as references (e.g. function foo(Bar &$bar)) are now highlighted correctly.

There are still issues, but I think they’re outside my Lisp programming ability, for the moment. This is certainly an improvement for now, though.

» Patch against php-mode.el v1.2.0

2 Responses to “Hacking on php-mode.el”

  1. scott Says:

    how to use message in “» Patch against PHP-mode.el v1.2.0″? It’s beyond my knowledge of emacs. :(

    can yo drop a few words or give a hint?

  2. Ian Eure Says:

    Download the patch. Move it into the same directory as “php-mode.el.”

    Run: “patch -p0 < php-mode-patch-1.patch”

    Byte-compile the new php-mode.el; from Emacs, run: M-x byte-compile-file - then give it the path to php-mode.el.

Leave a Reply