PHP_CodeSniffer + emacs 24: Compilation error

After ugprading to Ubuntu 13.04, emacs did not highlight compilation results from PHP_CodeSniffer anymore. Instead of a nicely colored log window, had the following in the *Messages* buffer:

Warning: defvar ignored because compilation-error-regexp-alist is let-bound
(No files need saving)
Error during redisplay: (void-variable compilation-error-regexp-alist) [4 times]
Compilation exited abnormally with code 1

A bug report gave me the hint about what to change:

To have the compilation mode variables globally available, I need to require the module in global scope, not in the scope of my phpcs-compilation definition.

So after adding (require 'compile) before (defun phpcs() .. in my .emacs file, compilation works properly again.

Written by Christian Weiske.

Comments? Please send an e-mail. Or Reply or Like.