Search code examples
emacsnxhtml

nXhtml is not highlighting PHP code, gives errors on loading


I'm using the latest nXhtml checked out from the repo, and using GNU Emacs version 24.0.91.1. When I open a PHP file it shows as un-syntax-highlighted text, and I get a compile error:

Error: Wrong type argument: number-or-marker-p, nil

and a message in the log:

File mode specification error: (cl-assertion-failed (functionp byte-compiled-fun))

I'm avoiding my .emacs and .emacs.d by running emacs with this command:

emacs -Q --eval '(load "/path/to/nxhtml/autostart")' /path/to/nxhtml/tests/in/heredoc.php

Even if you don't have a fix, how can I go about debugging this issue?


Solution

  • There seem to be a fair amount of such wrong-type-argument errors lately with the development version of Emacs (24). This might represent an Emacs bug. Or it might represent an nXhtml bug.

    I suggest starting by notifying Lennart, the nXhtml author, trying to give him a clear recipe, starting from emacs -Q.

    If that doesn't help, consider filing an Emacs bug: M-x report-emacs-bug.

    To try to debug it a bit yourself, be sure to load only source files (e.g. for nXhtml), i.e., *.el, not *.elc, starting preferably with emacs -Q (no init file). Do M-x set-variable debug-on-error t to see where the error is raised. Then perhaps use M-x debug-on-entry FUNCTION, where FUNCTION is the function where the error seems to have been raised. Then step through the Emacs debugger, hitting d to step and c to skip through a step.

    But again, I suggest starting with Lennart.