This page is a list of old solved or unconfirmed bugs for nXhtml. Please refer to the Launchpad bug tracker (see link from [1]) for new bugs, and don’t add any more to this page.

Solved problems


I have added .nosearch to all those subdirs in version 1.04 - thanks for telling me again!


I find nxml-where mode very useful. However I have two suggestions


I believe this as least partly is solved in version 1.04

Turning on by magic-mode-alist

(add-to-list 'magic-mode-alist '("<\\?xml \\(?:.\\|<br/> \\)+?>\\(?:\\|<br/> \\)<!DOCTYPE html " . nxhtml-mode))

Thanks, but this is not a problem with NxhtmlMode. This behaviour of Emacs has been discussed on the development list and there are some changes in the CVS version.

Smarty Support?

It’d be nice if nxhtml had SmartyMode support! – mjc

There is now Smarty support in the nXhtml 1.04 beta version. It does not cover the special {literal} … {/literal}. Because of the problems this gives with <style …> and <script …> regions these are not supported when using Smarty.

Php problems?

I’ve got some problems with php and mumamo mode and latest 1.04 beta:

Yes, just turn of the red underlines. You can do that from the menus (or with C-_):

    Completion and Validation
      Validation Helpers (for PHP etc)
        Hide Validation Errors (Red Underlining)
  • Certain keywords don’t get highlighted, ie. class, private, public, protected, function, etc.

A silly mistake by me. It should be fixed in the new beta I just uploaded I hope.

Looks like it’s working now, thanks. I noticed some strange colorization in comments, especially in /* */ blocks that span multiple lines and contain caracters like “’” (single quote) or “->”.

This has been fixed in the latest beta (2008-01-15).

I tried the latest beta (nxhtml-1.04-080117-11_01_06.zip) but it seems to have the same problem.

Then could you please send me an example. I can not reproduce this problem. – LennartBorgman

Try this inside a php method:

/* Try $this->test; */ (the word ‘test’ has a different color under linux)

I also noticed another strange colorization in php mode, while trying for example to refer to a constant with the word “INCLUDE” in it, for example:

define("APP_INCLUDE", "/home/app/include/"); include_once(APP_INCLUDE . "file.php"); //the word INCLUDE is highlighted with a different color

I can reproduce this. At the moment I solved this by making keywords case sensitive. Is this an acceptable solution?

I haven’t been able to use tabs instead of spaces while using php-mode and pressing tab, How can I do this? Also, which c-style is default and how can I set a default one (ie. k&r)?

Problem with quick customize buffer

Using emacs gtk in ubuntu, while opening the quick customize buffer display stops at:

Turn on Multiple Major Mode in all relevant buffers


while Messages buffer says: format: Symbol’s value as variable is void: mumamo-global-mode

I have no idea where this error comes from. However mumamo-global-mode is gone in nXhtml 1.10

css-mode, javascript-mode and php-mode


First, thank you very much for Nxhtml-mode. It’s the most perfect mode for web developping in emacs ( i was waiting for this since a long time, i’m so proud to prove to my friends that emacs is better than Aptana for Web Dev).

Concerning the css, js and php mode : It seems to me that the 3 modes we can find here : http://mewde.blogspot.com/ are more ‘uptodate’ that those in Nxhtml-mode. Don’t you think it would be great to replace them with those of Mewde ?

thanks again riccco

nXhtml has (as far as I know) now the latest php-mode from Aaron. It also uses the latest js mode (ie the one that has been suggested to be added to Emacs). The css-mode that comes with Emacs is used if available.

Php extension .phtml missing

Could you please add .phtml as a default php extension? It’s used in Zend Framework as a default extension for view templates. Also what’s the status of color problems for php comments? I noticed that there’s still a problem when ‘->’ characters are inside a commented line. Thanks


Fixed some problems with find-recursive.el

nXhtml comes with a find-recursive.el with some fixes. Unfortunately those introduced some bugs. Fixed in version nXhtml v 1.17

Setting Highlight Background Colour?

When I open a PHP file with nxhtml-mode, all texts are with highlighted background and this is quite annoying in some colour scheme (such as when started emacs with --reverse-video), is it possible to turn this highlighting off? Thanks! – Yan

Hi Yan, Yes you can customize the colors:

  M-x customize-group RET mumamo RET

I know there might be some problems with the colors when you are using dark backgrounds for example. Suggestions for better default background colors in chunks in this case are welcome!

Alternatively, put the following codes in your .emacs to completely disable the background color:

(custom-set-faces '(mumamo-background-chunk-submode ((((class color) (min-colors 88) (background dark)) nil))))

No, please don’t. That may damage other face customizations. Use customize instead. If you do not want background colors then do

  M-x customize-option RET mumamo-chunk-coloring RET

How to Save "Hide Validation Error" Setting?

It is somewhat annoying that every time I opened a PHP file I’d have to push C-c _ to turn off the validation errors. How could I set it (I mean turn off all validation errors) in my ~/.emacs file? Thanks! – Yan

(BTW, I searched through the source code but found nothing useful)

(BTW2, there’s a typo at nXhtml homepage: “show you waht is”…)

The way to search for how to turn off it permanently is to use F1 k or C-h k. That will take you to the sources executed by next command. It works even with the menus. (That is part of the beauty of Emacs.) Please tell me if you find it.

Thanks, I correct the spelling. BTW I have just started to use FlySpell (which means that nXhtml now supports it…)

Thanks Lennart, I found the command (nxhtml-toggle-visible-warnings). First I tried to add it into my ~/.emacs like this but it doesn’t work:

(defun my-nxhtml-hook ()
(add-hook 'nxml-mode-hook 'my-nxhtml-hook)
(defun my-php-hook ()
(add-hook 'php-mode-hook 'my-php-hook)

And second I thought it is “toggle”, but what I want is to “disable”, I think there’s difference between these two actions. Any help on this? Thanks again for your previous time! – Yan

If you want to turn off the warnings by default you can use

  (eval-after-load 'nxhtml '(nxhtml-toggle-visible-warnings))

Unfortunately there is no simple way to do it per buffer since information is carried by a symbol not a variable and symbol properties can not be buffer local.

PS: I just noticed that the changes to nxml makes the error warnings disappear for ever if you use a newer version of Emacs. Fixed in next version of nXhtml.

Problem with Ruby font-locking

I have (mumamo-global-mode t) and (add-to-list ‘mumamo-filenames-list ‘(”.erb\\’” “eRuby nXhtml Family”)) in ~/.emacs but opening a *.html.erb file doesn’t turn on mumamo-mode. I’m using the latest beta version of nXhtml. What am I missing?

Nothing this should work and it works for me. (I am using Ruby 1.8.6) Could you provide more details, please? Maybe you can send me an example file? (If you use the bug reporting for nXhtml it may be easier.) – LennartBorgman

nxhtml-1.04-080116-02_08_46 breaks font-lock in ruby-mode. After opening a file in nXhtml mode, opening a ruby file causes no font-locking to occur.

This works for me. Could you provide more details, please? Still waiting for more details. – LennartBorgman

I had this problem when I had a ruby-mode hook enable PrettyLambda when ruby-mode was turned on. Disabling pretty lambda made the problem go away. I am sad to lose pretty lambdas, but I like nxhtml-mode much better.

Thanks for telling us Phil!

Should require cc-defs

When loading nxhtml-mode using emacs -Q I notice that it fails because it needs some things that are defined in cc-defs, but it does not explicitly require cc-defs.

I can not reproduce this with my current nXhtml beta. Are you using the latest released nXhtml? If not try that. If you already are using that then please try the latest beta (which I do not yet propose for active work).

This seems to be fixed in the beta; thanks. (It was only happening with Emacs23.)

void-variable c-emacs-features


I upgraded to 1.28 and got this error when I restarted emacs:

Debugger entered--Lisp error: (void-variable c-emacs-features)
  (memq (quote 8-bit) c-emacs-features)
  (cond ((memq ... c-emacs-features) (modify-syntax-entry 47 ". 1456" css-mode-syntax-table) (modify-syntax-entry 42 ". 23" css-mode-syntax-table)) ((memq ... c-emacs-features) (modify-syntax-entry 47 ". 124b" css-mode-syntax-table) (modify-syntax-entry 42 ". 23" css-mode-syntax-table)) (t (error "CSS Mode is incompatible with this version of Emacs")))
  (if css-mode-syntax-table nil (setq css-mode-syntax-table (make-syntax-table)) (modify-syntax-entry 43 "." css-mode-syntax-table) (modify-syntax-entry 61 "." css-mode-syntax-table) (modify-syntax-entry 60 "." css-mode-syntax-table) (modify-syntax-entry 62 "." css-mode-syntax-table) (modify-syntax-entry 45 "w" css-mode-syntax-table) (modify-syntax-entry 47 "w" css-mode-syntax-table) (modify-syntax-entry 46 "w" css-mode-syntax-table) (modify-syntax-entry 39 "\"" css-mode-syntax-table) (cond (... ... ...) (... ... ...) (t ...)) (modify-syntax-entry 10 "> b" css-mode-syntax-table) (modify-syntax-entry 13 "> b" css-mode-syntax-table))
  eval-buffer(#<buffer  *load*<3>> nil "/home/tennis/elisp/emacswikicode/css-mode.el" nil t)  ; Reading at buffer position 8727
  load-with-code-conversion("/home/tennis/elisp/emacswikicode/css-mode.el" "/home/tennis/elisp/emacswikicode/css-mode.el" nil t)


I think there is a bug in the css-mode you are using. Please use the css-mode that comes with nXhtml or the one in Emacs 22.*/23.* if you have a sufficiently new Emacs.

Thanks! That worked. FYI, the css-mode file I used is the one here on the wiki. That will need updating. -Tennis

I think that the css-mode.el that is included in Emacs is the one to use. Maybe you can put a note on CascadingStyleSheetMode that the one you used does not work with nXhtml. I do not know which one it is.

Hi Lennart, To answer your question, the css-mode file I was using was: http://www.emacswiki.org/cgi-bin/wiki/css-mode.el

Thanks, that means you were using Alex Shinn’s css-mode.el that has not been updated since 2002. Now we know that one does not work with nXhtml.

Doesn't recognize <?

?> blocks ====

I’m really impressed with nxhtml-mode in general, but it gets confused by the <?= ?> blocks used to show a php variable. Instead of treating the inside as php, it thinks it’s still HTML and reports it as an invalid tag. It’s especially bad when you have the block as the value of an attribute; <img src=”<?=$img?>” alt=“image” /> messes up all the highlighting after the <?=.

On a vaguely related note, accidentally typing <?> results in emacs freezing.

I have left out the optional syntax <?= … > since you can use <?php echo … ?> instead. Is not that syntax the recommended?

Using <img src=”<?php echo $img ?>” /> is however still a problem. The NxmlMode parser gets upset with this construct which violates XML standards. Currently there is nothing to do about this other than turn of the validation or hide the validation errors.

Thanks for telling about the <?> problem, it is solved in version 1.29.

Invalid read syntax:"] in a list

This problem is hopefully solved in latest released version 1.33

Nxhtml 1.33 is broken on emacs 22.

Warning (mumamo-post-command): Symbol's value as variable is void: fill-forward-paragraph-function

Thanks, I think I have fixed that now. It was a one line change (just checking if this variable was defined). I do not have time to change the version number now, but I have uploaded a new zip file with the same version, ie v 1.33 - please try it and see if this works in Emacs 22.

Still broken. M-x nxhtml-mode works, but faces are different probably due to MuMaMo errors.

Using vacuous schema
File mode specification error: (setting-constant nil)
mumamo-fontify-region: Attempt to set a constant symbol: nil
** In buffer test.html
  (let ((standard-output standard-output)) (backtrace))
  (let ((standard-output ...)) (let (...) (backtrace)) (with-current-buffer standard-output (prog1 ... ...)))
  (with-output-to-string (backtrace))
  (let ((format-string2 ...) (bt ...)) (mumamo-message-with-face (concat ... "
" ... bt) (quote highlight)) (apply (quote message) format-string2 lwarn-type args) (run-with-idle-timer 1 nil (quote mumamo-show-report-message)) (when mumamo-display-error-stop (setq font-lock-mode nil) (when ... ...) (when ... ...) (apply ... format-string2 lwarn-type args)))
  mumamo-display-error(mumamo-fontify-region "%s" "Attempt to set a constant symbol: nil")
  (condition-case err (let (... ...) (mumamo-fontify-region-1 start end verbose)) (error (mumamo-display-error ... "%s" ...)))
  (if (not mumamo-use-condition-case) (let* (... ...) (let ... ...)) (condition-case err (let ... ...) (error ...)))
  (mumamo-condition-case err (let (... ...) (mumamo-fontify-region-1 start end verbose)) (error (mumamo-display-error ... "%s" ...)))
  (if (and mumamo-just-changed-major nil (= 0 ...)) (mumamo-display-error (quote mumamo-fontify-region) "Just changed major, should not happen") (mumamo-condition-case err (let ... ...) (error ...)))
  mumamo-fontify-region(1 102 nil)
  font-lock-fontify-region(1 102)
  run-hook-with-args(font-lock-fontify-region 1 102)
  byte-code("\302\303 	#\207" [start next run-hook-with-args jit-lock-functions] 4)
  jit-lock-fontify-now(1 501)
  display-warning(mumamo-post-command "Attempt to set a constant symbol: nil" :warning)
  lwarn(mumamo-post-command :warning "%s" "Attempt to set a constant symbol: nil")
  (condition-case err (if font-lock-mode (mumamo-set-major-post-command)) (error (mumamo-msgfntfy "mumamo-post-command %s" ...) (lwarn ... :warning "%s" ...)))
  (if (not mumamo-use-condition-case) (let* (... ...) (if font-lock-mode ...)) (condition-case err (if font-lock-mode ...) (error ... ...)))
  (mumamo-condition-case err (if font-lock-mode (mumamo-set-major-post-command)) (error (mumamo-msgfntfy "mumamo-post-command %s" ...) (lwarn ... :warning "%s" ...)))
  (progn (mumamo-condition-case err (if font-lock-mode ...) (error ... ...)))
  (if mumamo-multi-major-mode (progn (mumamo-condition-case err ... ...)))
  (when mumamo-multi-major-mode (mumamo-condition-case err (if font-lock-mode ...) (error ... ...)))

mumamo-fontify-region: Attempt to set a constant symbol: nil
MuMaMo error, please look in the *Message* buffer

Eh, sorry. I should have thought first. This is fixed in the released version (from the normal download page) that I just uploaded.

nxhtml mode download site is down :(((

Please can someone bring this site back or could someone upload nxml*.zip to some other server?

The site is up again and in the future I plan to move this to a code repository.

Genshi Support?

Is it possible to add support for Genshi? – jcc

Genshi support has been added.

Sub-mode replacement

Is there specials things ( variables customization ) to do with nxhtml parameters to replace the php-mode or javascript-mode with one of our choice ?

Yes, there is the defcustom mumamo-major-modes:

  M-x customize-option RET mumamo-major-modes RET

Note that if the major mode you want to use does not follow Emacs conventions there might be problems.

Problem with Ruby indentation (actually any one line submode)

I’m having problems using nxhtml-mode to edit html.erb files, I get "Unclosed tab <=>" error when I press TAB. I’m using Emacs 23. Indentation is not working as desire because of this error too.


I am sorry Jorge, but you have to give much more details about the problem. Please show an example and tell exactly what you do.

Well, it is not nothing special, I just installed nxhtml as recommended in rinari README, it is like:

;; nXhtml
(load "~/.emacs.d/elisp/nxml/autostart.el")

(setq nxhtml-global-minor-mode t
      mumamo-chunk-coloring 'submode-colored
      nxhtml-skip-welcome t
      indent-region-mode t
      rng-nxml-auto-validate-flag nil
      nxml-degraded t)

Just open an rhtml or html.erb file, write something, press TAB and get nothing but an error in minibuffer saying Unclosed tag <=>

Indentation problem with eRuby code, example:

<%= t("Hola") %>
  <%= link_to name, target %>
    <% if quiero do %>
      <%= do_something_nifty(with_me) %>
        <% end %>

My environment is:

OS: Linux (LinuxMint 5.0, ubuntu based distro)
Emacs: GNU Emacs (i486-pc-linux-gnu, GTK+ Version 2.12.9) of 2008-03-19 on vernadsky, modified by Debian
nxHtml: 1.33

thanks for your time, Jorge

Thanks, please try the 1.34 beta here http://ourcomments.org/Emacs/DL/elisp/nxhtml/beta/

False-positive validation errors

Labels and inputs in forms are incorrectly flagged as invalid. In this valid sample document, the label and input will be considered errors:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml">
    <form action="" method="get">
      <label for="inputname">Label for field: </label>
      <input type="text" name="inputname" id="inputname" />


Thanks Lucas. I believe this is a bug in NxmlMode. Since this is part of CVS Emacs 23 you can file a bug report for it. Or try to fix it of course. I believe that the wrong DTD is used (strict instead of transitional) and that this is just a simplification.

I have posted a report at http://www.emacswiki.org/cgi-bin/wiki/NxmlMode . But no answer yet.


Hi Lucas, excuse me for beeing unclear. I meant that you should file an Emacs bug report (since it is part of Emacs). You can do that from the help menu in Emacs (but please use an unpatched Emacs then). I just filed a bug report for this.

Bug in sex-mode.el in nXhtml 1.34

Unfortunately there was a bug in sex-mode.el in nXhtml 1.34. To fix it change line 117 to

                    (if (and t

It has been fixed in nXhtml 1.35 and it is the only change in that version of nXhtml.

Ruby lost font-locking

Hi Lennard, I still have lot of problems to run nxhtml, I lost ruby fontification and got many errors like

Error during redisplay: (error Variable binding depth exceeds max-specpdl-size)

I got this when I open any rhtml (or html.erb) file: http://pastie.org/244002

Hi calas, thanks for reporting this. I am sorry for the trouble. However I can not reproduce this problem. Can you please tell me more details about your setup and also send me an example of an .rhtml file that you can not open?

Phil Hagelberg reminded of this problem (see also MuMaMo):

“Lennart Borgman (gmail)” <lennart.borgman@gmail.com> writes:

> > I looked a bit at ruby-mode.el and it sets up fontification variables
> > in ruby-mode-hook. Could you please move that code into the function
> > ruby-mode before the hook? (The hook should be run after the mode is
> > setup.)

Thanks for tracking down the problem! I am not the maintainer of ruby-mode.el, but I have fixed the issue you mentioned, and the problem I was seeing with mumamo has disappeared. I got a few fellows from the Emacs channel on Freenode to try it out, and they have not had any problems.


I’ll submit the patch to the ruby mailing list once I’ve gotten a chance to use it for a few days and make sure nothing goes wrong.


I was getting the lost fontification due to a bug that Lennart found in ruby-mode. Try getting the latest from SVN or from my dotfiles[1]; that fixed the problem for me.


1 - http://github.com/technomancy/dotfiles/tree/master/.emacs.d/ruby-mode.el

Django template problems

I’ve noticed that django templates seem to give mumamo problems (lots of warning and error messages, and is too slow to use). The workaround I’m using now is to use django-html-mode and then edit mumamo-fun.el and replace the 4

(cons exc-start 'django-mode)


(cons exc-start 'django-html-mode)

Thanks for reporting the problem, but I am not sure whether you are using a current version of nXhtml and what version of Emacs you are using. So I do not know if there are any problem.

If you want to change what mode is used for django-mode chunks then please use the defcustom mumamo-major-modes for that. Try to avoid changing the code like above since this will create confusion when reporting problems or sharing tips with others.

There is a reason that I have included a django.el with nXhtml. I have seen several problems that are difficult do diagnose because of bugs in major modes that does not show up until you try to use them with nXhtml.

The new release tries to support Django a little bit better. Unfortunately this may mean that there is trouble to make other django-mode:s work at all with it.

Beside this please try to start from emacs -Q when you investigate problems. This avoids that there is any problem in your setup.

A convenient way to to this is to do

  M-x emacs-Q-nxhtml

which will just load nXhtml and after emacs -Q.

Anyway I have just made some changes in the Django support that I hope should make it faster. Those changes are in nXhtml ver 1.37 which I have just uploaded.

Thanks, this seems to be working well for me now. (And I was using emacs and nxhtml 1.36 if it still matters to anyone)

Thanks Bryan. But when you say that you are using a not yet released Emacs then please also tell the CVS checkout time.

Issue with ido

Hi, i am using latest Emacs CVS, i use ido and nxhtml mode. Here is my problem: in my .emacs if i load nxhtml using (load-file “~/.emacs.d/lib/nxml/autostart.el”) and later enable ido using (ido-mode t) ido is enabled which is what i want but if i enable ido first and then load nxhtml ido is disable which looks like a bug.

Yes, thanks, it is. I will try to fix it when I get time.

Shame it needs Emacs 22

I love nxml-mode and I’d love to use nxhtml-mode too, but for various silly reasons it’s not possible for me to upgrade from Emacs21 at present. nxml-mode works fine in Emacs21… it would be nice if backwards-compatibility was on the “to do” list for nxhtml-mode too, though I realise there may be very good reasons why it requires Emacs22!

Unfortunately I do not have time to backport nXhtml to Emacs 21. If someone else wants to do it then please do it. I can put such a version on my download area, but please be prepared to take care of the changes I make to nXhtml too.

And beside Emacs 23 may soon be out … ;-)

Nesting submodes within submodes

Is it possible to nest submodes in submodes (jacobolus asked that here)?

No, not yet. But I have taken some steps towards it. If anyone wants to finish that work please contact me. I am going to put nXhtml in a repository so we can cooperate.

Problem with xhtml mode, ruby mode, and css mode

I have a problem trying to embed ruby code into a style attribute. The goal is go from this: <div class=“widget”> To this: <div class=“widget” style=”<%= @widget_style %>”>

As I try to type the new text, the moment I press the ‘%’ key emacs freezes, its CPU usage goes to about 99%, and I’m left with no choice but to kill emacs (via ‘Force Quit’). This is with nxhtml version 1.03, and carbon emacs, both ‘Fall 2007’ and ‘Winter 2008’ versions, both build from Emacs 22 CVS. A good workaround in my case would be to just disable CSS mode in .html.erb files. Can this be done easily? Thanks. – sockmonk

Hi sockmonk, thanks for the bug report.

There are several problems here. First, Emacs should of course not freeze. That is perhaps most essential. I can not reproduce that with the latest beta though. Maybe you can send me a bug report with a file using the nXhtml menu? Please describe exactly what you are doing when Emacs freezes. I just started typing style=”<% but nothing special happend. And when I reached the second % nothing happened there either.

Disable CSS mode in .html.erb files? Yes, you can do that, but you have to add a new chunk family. Chunk families are in mumamo-chunk-family-list in mumamo.el. You can just copy the one you use (probably “eRuby nXhtml Family”), rename it and remove mumamo-chunk-style= from the new copy.

What you did should have reproduced the freeze; it does for me every time. Perhaps it’s fixed in the beta you’re testing; as I said, I’m using 1.03, which still appears to be the latest stable version. I went into mumamo.el and commented out every line that said ‘mumamo-chunk-style=’, but still had the same problem. So regrettably, I think I’m going to have to disable nxhtml-mode for now, just to avoid the crashes. I’ll probably try it again when the next stable version is out though. Thanks very much for sharing this. – sockmonk

Hi again sockmock, It might very well be a problem in 1.03. I would be glad if you could try the latest beta. The betas are very stable, but I do not want to annoy people with too frequent releases. (Also at the this time some things are changing in the ways that mumamo is turned on.) Please contact me be mail if you want to test, my mail address is in the source files.

similar problems in javascript mode

Using latest carbon emacs… I am experiencing similar problems as sockmock when editing large javascript files, in my case the mootools framework (~7k lines). Just load up the file, manually or automatically switch to javascript mode, scroll around a bit and fizzzzz…. time to force quit.

– jim-jam

Hi jim-jam, I can confirm that this happens. This seems to be a problem with Emacs itself or perhaps javascript.el. I am writing an Emacs bug report now. Which version of Emacs are you using?

I am using Carbon Emacs ( – jim-jam

Thanks, I have added that to the bug report.

Strange syntax highlighting (Emacs 22)

Syntax highlighting is strange on nxhtml 1.32. It works fine on nxhtml 1.26. After the second double quote sign (”), characters remain in the font-lock-string-face. The value of the major-mode is nxhtml-mode and css-mode (in the css region). Nxhtml 1.32 works on emacs 23 (Emacs i686-pc-linux-gnu), but it doesn’t work on emacs 22 (Emacs 22.1.1 i686-pc-linux-gnu).

<span style="color:red">red</span>

However, the syntax coloring is still broken on nxhtml-1.33-080630. Any idea?

Thanks, I can reproduce it starting with the ‘-Q’ option (use this, not -q) and Emacs 22. (This problem is not there in Emacs 23.) I have no solution to this now. A work around for you may be to use nxhtml-mode instead of nxhtml-mumamo when you edit the buffer. That will of course not give you the benefit of multi major modes, but you can at least edit the file.

I think I can guess the reason for the problem. I will try to look into this when I have time. Unfortunately I can’t do it now.

I think this is solved in version 1.41.

100% CPU on php file (Emacs 22 only, workaround available)

I tried to open a php file with no ?> ending tag at the bottom (under ubuntu). The CPU usage goes 100% and stays there for long time, I have to kill the process, any idea? Will php files with no ending ?> tag be supported? Thanks

Hi, php files with no ending ?> might be supported if you send me an example. ;-)

I can’t reproduce this problem so I need and example.

I think it happens with code like this, that contains constants with the word ‘INCLUDE’ in it and no closing tag at the end. It’s common practice to omit the closing ?> tag in files that contain only php code (ie. classes, etc) to prevent the output of unwanted characters by the interpreter:



class Test
	public $var1;
	function __construct()
		$this->var1 = 5;

Notice there’s no ?> at the end. While trying to edit this file it seems that emacs is trying to reformat highlighting continuously…

Thanks, bu sorry, I still can not reproduce the problem. Which version of nXhtml are you using? What version of Emacs do you use?

Perhaps it would be better if you used the bug reporter for nXhtml. It is in the menus:

  nXhtml / nXhtml Help and Setup / Report a Bug in nXhtml ...

Ubuntu 8.04, emacs 22.1.1, nxhtml 1.30, it happens when trying to edit the file, emacs becomes a lot slower, if you need any other info please let me know, I sent a bug report, don’t know if it has been received. Thanks!

Thanks. I think I have fixed the problem now. Could you please test and confirm?

Hi, slowness disappeared but when I hit return to add a line in function __construct all the highlightning preceding the line where I hit return disappears… Thanks

Thanks for confirming that the old problem is gone. I can not reproduce the new problem. Can you please describe more in detail what you did and what is happening?

Using the example above I simply placed the cursor at the end of the row with “$this->var1 = 5;” and pressed return. All the highlighting of text before that line disappeared… Thanks!

I am sorry, but I still can not reproduce this. Can you please start from

  emacs -Q
  M-x load-file RET Your-PATH-TO/nxml/autostart.el

and report each step you do?

After opening emacs with the commands you gave simply do:

  1) C-x C-f (open file that contains the php chunk above)
  2) Move the cursor at the end of line 16 ($this->var1 = 5;)
  3) Press return. All the colors in text from lines above 16 disappear.


Thanks. I can reproduce it now, but only in Emacs 22, not CVS Emacs 23. Something strange happens with after-change-functions.

Problem is still present on nxhtml 1.40. CPU on 100% and slows down everything. It also reports a mumamo: file not found error from time to time.

I think this is solved in version 1.44 of nXhtml. Please test.


Emacs 22.2 or later contains css-mode. Probably nxhtml doesn’t need it in (related/css-mode.el).

Thanks. Removed.

tests directory?

Does nxhtml work when the user removes the “tests” directory?

Yes, but why do you ask?

I am maintaining Emacs distribution with elisp libraries. If I can remove the tests directories (~1MB; in the case of nxhtml) of elisp libraries, I can save the total file size. In some countries the Internet connection is not so good as that of US/Japan.

Ah, thanks for your effort doing that. I have removed nXml from the nXhtml distribution since this is now in the not yet released, but working, Emacs 23. If you are using Emacs 22, then please look in NxmlMode for how to get it.

Does removing the nxml directory mean farewell to Emacs 22? It would be nice if you plan a stable nxhtml release, before removing it. As you may know, Emacs 23 is not yet so stable on Macs.

No. You can use much of nXhtml without nXml. nXml gives completion and validation, but the other parts can still be used.

nXhtml and ruby-mode

I noticed that nxhtml comes with its own ruby-mode. How to use emacs’ built-in ruby-mode?

nXhtml does not come with its own ruby-mode. I guess you mean that there is a multi major mode that is used for ruby files. This multi major mode uses the ruby-mode that you have installed.

If you do not want this multi major mode then you can change auto-mode-alist. Look in the file nxhtml-autoload.el.

I guess the following line in nxhtml-autoload.el is the problem.

 (autoload 'ruby-mode "../tests/in/pastie-246693.txt-ruby-mode" ...

That indeed looks like a problem, but where is that line? Is it something I forgot to remove in some version or? Which version of nXhtml?

Oh, I pointed the wrong file. That line is found in l. 1509 in nxhtml-loaddef.el in nxhtml-1.60-081006.zip. I found a lot of autoload definitions which contain the “tests” directory. Thanks for your quick response.

Thanks Seiji, I have fixed this in the next version (1.61) of nXhtml.

I confirmed that the problem was fixed. Thank you.

nXhtml interferes with emacs-rails

Since find-recursive.el in nxhtml is intentionally modified, emacs-rails (which requires find-recursive.el) cannot start if the load-path contains the nxhtml directory.

If nxhtml doesn’t use find-recursive, why not remove it?

Thanks Seiji. I was waiting for some comments about this and it is removed in version 1.63.

I confirmed that this problem was fixed. Thank you.

Conditional Loading

If you use emacs for everything (say using emacs-client with emacs as an alternative) you’ll sometimes want to load emacs for something quick like a mail and you’ll have to start a new one as you don’t have a server running. In situations like this you’ll not want to wait for big modes like nxhtml to load. This elisp (with an imperfect regex) will load nxhtml only when required:

  ;; Conditional load of nxhtml because its really heavy, but really good.
  (setq *nxhtml-autostart-file* (expand-file-name "~/.elisp/nxhtml/autostart.el"))
  (defun load-nxhtml-if-required ()
    (if (and (string-match ".+\\.\\(php\\|html\\)$" (buffer-file-name))
             (not (featurep 'nxhtml-autostart)))
          (load *nxhtml-autostart-file*)
          (nxhtml-mumamo-mode)))) ;; mumamo loads nxhtml-mode et al
  (add-hook 'find-file-hook 'load-nxhtml-if-required)

After seeing this I did some work on autoloading things in nXhtml. Without doing anything except byte-compiling nXhtml (from the nXhtml menu) it now loads on my old pc in 0.3 seconds.

I use the following to autoload nXhtml, inspired by a snippet seen at NxmlMode:

  (mapc (lambda (list)
          (mapc (lambda (pair)
                  (if (or (eq (cdr pair) 'html-mode)
                          (eq (cdr pair) 'php-mode))
                      (setcdr pair (lambda ()
                                     (require 'nxhtml-mode "path/to/nxhtml/autostart")
        (list auto-mode-alist magic-mode-alist))

Oh, I never thought of adding autostart like that. Apart from that you can also use Major Mode Priorities in the nXhtml menu to choose when to use nXhtml multi major modes.

Mumamo support for PHP heredoc?

PHP heredoc can be used, for example, to store html code in a variable. Of course, Mumamo cannot know what kind of text is within the heredoc. Would it be possible to add support for a special kind of comment which when given on the line before the variable initialization would hint at the mode within the heredoc, so Mumamo can handle it as HTML?


  // mumamo: html
  $htmlstuff = <<<EOT

     <p>some stuff</p>
     <p>some other stuff</p>


Yes, that could be done. I did that before in perl, but no one reported that it was broken (which it currently is) so I did not care to fix it. But since you are asking for that in php I will think it over again.

But the solution in perl was to use a special name for the tag instead, something like EOT-HTML. Would not that be easier to read? It is ceartinly a bit more easy to fix.

EOT-HTML is fine. It’s the result that matters. :) Would it detect properly embedded Javascript too and switch to Javascript mode for that region if the HTML within the heredoc contains JS code in script tags?

Some corrections: EOT-HTML is not good, because the PHP parser does not accept it, so it should be EOTHTML instead. Furthermore, according to the specification quotes can be around the identifier, so these are all legal:

  $htmlstuff = <<<EOTHTML

     <p>some stuff</p>
     <p>some other stuff</p>


  $htmlstuff = <<<"EOTHTML"

     <p>some stuff</p>
     <p>some other stuff</p>


  $htmlstuff = <<<'EOTHTML'

     <p>some stuff</p>
     <p>some other stuff</p>


I have implemented support for heredocs. However it is yet only in multi major modes specialized for just this, see the realese notes for 1.87.

Cool, thanks! It seems to work well. Only the embedded Javacript sections are not recognized within the HTML heredoc, but if I understand you correctly it shouldn’t work, because JS doesn’t support heredocs?

BTW, I had to fix a typo. My Emacs doesn’t have a‘string-match-p’ function:

(defun mumamo-mode-for-heredoc (marker)
  "Return major mode associated with MARKER.
Use first match in `mumamo-heredoc-modes'.
If no match use `text-mode'."
  (let ((mode (catch 'mode
                (dolist (rec mumamo-heredoc-modes)
                  (let ((regexp (nth 0 rec))
                        (mode   (nth 1 rec)))
                    (when (string-match-p regexp marker)
                      (throw 'mode mode)))))))
    (if mode
        (mumamo-major-mode-from-modespec mode)

No, it is not a typo. It is a forgetto. I forgot that string-match-p does not exist in Emacs 22. Please try beta 1.88 which I just uploaded. It fixes this problems and also (finally) implements chunks in chunks. So now you could just use html-mumamo-mode (which is default for php files in nXhtml).

I tried it, but something is broken compared to the previous version. Normal heredoc works properly, but if I use EOTHTML it switches to HTML mode, but it fails to reocgnize the EOTHTML; end tag and the rest of the PHP file is treated as HTML. At one point it switched to Javacript mode after the end tag, so probably the chunk in chunk handling broke something.

Yes, you are right. I forgot to implement one part. Can you please try the new beta 1.88?

One part that needs work is colors of the subchunks. I have only done that for light background. If someone who uses dark background want to suggest chunk colors for dark background that would be very nice.

Looks like this version recognizes the chunks correctly, but another strange regression occurred: if the HTML heredoc contains embedded javascript then the buffer after the heredoc closing tag is colored with an underline face (mumamo-border-face-in) until the next double quote, like when something is not right with the syntax in the buffer.

It would still be good with an example, but I fixed some bugs related to this. There are still minor bugs, but I think it is quite good and you might not notice those I am thinking of.

I managed to create an example. The code is underlined from the first EOTHTML end tag until the next EOT. If you delete the onclick attribute from the last heredoc the underlining disappears:

$a = <<<EOTHTML



$b = <<<EOT

    <h2><a href="/">stuff</a></h2>


$c = <<<EOT

<button onclick="a()">test</button>


Thanks for the example. I couldn’t reproduce that first but now I can. Yes, that is a last thing I have not implemented yet. Will do that now…

If you want to you can report this as a bug on Launchpad, which makes it easier to send files. Since this is getting long the lack of structure here makes it a bit hard to read too.

This version behaves exactly the same as the previous one (the underline is there) with the above example, so the bug is still there. I tried the nxhtml-1.88-090711-20_54_25.zip version.

I don’t have a Launchpad account and don’t want to register just for this bug, since we’re close to solving it anyway. If I have further bugs to report then I’ll register.

Please try the newest beta and see if you still have any problem.

I tried 1.89 with emacs 23.1. Looks like it doesn’t handle the case properly when embedded HTML contains embedded Javascript. It recognizes the start of the embedded javascript and there it changes face (from mumamo-background-chunk-submode2 to mumamo-background-chunk-submode3), but it fails to recognize the closing EOTHTML, or more precisely, it doesn’t recognize the end of the embedded Javascript section, so the whole rest of the buffer is colored with mumamo-background-chunk-submode3 face.

1.88 handled this case better, aside from the other problems.

Some more info: Looks like if the embedded Javascript is simple and short then it recognizes its end correctly, but if the JS is more complicated (several pages long) then it gets confused by something.

Found the cause of the problem. If the embedded Javascript closing part is in the first column like the EOTHTML then it fails to notice the end of the js block:



If the JS closing part is indented then it works well:



So I indented my JS block closings and now everything is OK.

Thanks for telling us about the bug and how to work around it. Strange that no one has noticed it before. I have just installed a fix for it and released version 1.91.

Could this EOTHTML metaphor work with other languages in heredocs? Say, I’d like to embed a query in an EOTSQL heredoc…

Yes, of course. But you have to write a multi major mode for it. Please see those that are already defined. It should not be very hard to do it. And please contribute what you write back to us all!

Error if xhtml-loader.rnc is read-only

Nxhtml throws an error when xhtml-loader.rnc is read-only, however, please remember that elisp files are usually read-only when a root user installs them on multi-user systems (like Un*x).

This file is rewritten if needed when the user uses nxhtml-mode the first time. So I think all that is needed is that you from the root user loads nXhtml.

Symbol's function definition is void: <

I frequently experience this error and I suspect Nxhtml is responsible, because I didn’t have a similar problem before I started using it. It is very annoying, because I loose the definition of < (less-than) which breaks everything, so I can only restart emacs to fix it.

Any idea what could cause it? Does Nxhtml redefine the meaning of <?

I use 1.80 on Gnu Emacs 22.3.1, but this error also occured with previous Nxhtml versions too, so it must be some fundamental bug.

I also got this on 16.m10.2008 with nxhtml 1.60, but later not anymore, perhaps because I started using Emacs 23. --DanielClemente

Hm, a very strange bug. I can’t even think of how it can happen. Could you who have this problem now please report it as a bug in the bug database on launchpad? And please try to reproduce the problem starting from “emacs -Q” and then just loading nXhtml.

There is nothing in nXhtml that redefines <. Could you please try with

  emacs -Q -l PATH-TO/nxhtml/autostart.el

and see if < is defined then?

Yes, it’s defined then, but this is not the problem. Nxhtml works well usually, so < is not undefined when it is loaded. It happens when I edit php files with Nxhtml and emacs is already running for a while. All of a sudden when I try to save a file or do something else the operation fails, because < became undefined.

It’s hard to debug, because it just happens and I can’t really connect it to anything special. I do not even know how could I pinpoint what code is responsible for undefining a function.

Thanks. I wonder if this is a (severe) bug in Emacs. I have asked on Emacs Devel for some hints about how < could become void.

Could you please do two things:

  • Move this to a bug report in launchpad (see above for URL) so we can keep it more structured.
  • Try to run under “emacs -Q -l PATH-TO/nxhtml/autostart.el” to see if it happens there too. Turn on debug-on-error too so the error gives a backtrace.

The only function that can make a function void is ‘fmakunbound’. Try advising it to trap the culprit; I don’t think the byte-compiler inlines it, so it will take effect everywhere. --DavisHerring

Thanks Davis. Then dear anonymous could you please eval this defadvice and then edit with nXhtml as you normally do. When the problem occurs you will hopefully have a backtrace in Messages buffer that will tell us what has happened:

  (defadvice fmakunbound (before
    (message "fmakunbound %s, backtrace\n%s"
             (ad-get-arg 0) (with-output-to-string (backtrace))))

Okay, I’ll try it. I’d wait with the bugreport until we’re sure it’s nxhtml’s fault. Regarding the running emacs with -Q idea: I have lots of customizations in emacs and as I said the problem occurs only after a while of extensive usage, so it’s not an option, because using Emacs without my settings is unthinkable. So I skip this one. Let’s hope the defadvice helps.

When I got the error, it was under the same circumstances you described: editing some multiple-major-mode file like PHP, and suddenly being broken. I have looked into my version control and the only places where I was using fmakeunbound were the following:

  • .emacs.d/muse/muse.el: (fmakunbound ‘find-buffer-file-type)))))
  • .emacs.d/cedet-1.0pre4/common/cedet-edebug.el: (fmakunbound ‘cedet-edebug-prin1-to-string-inner))
  • .emacs.d/emacs-w3m-cvs/w3m-util.el: (fmakunbound ‘select-frame-set-input-focus)))
  • .emacs.d/emacs-w3m-cvs/w3m.el: (fmakunbound ‘,fn)))
  • .emacs.d/emacs-jabber-tla/fsm.el: (fmakunbound (intern (format “start-%s” name)))
  • .emacs.d/ecb-snap/ecb-layout.el: (fmakunbound (intern (format “ecb-layout-function-%s” name)))
  • .emacs.d/ecb-snap/ecb-layout.el: (fmakunbound (intern (format “ecb-delete-window-ecb-windows-%s” name)))
  • .emacs.d/ecb-snap/silentcomp.el: (fmakunbound fun)
  • and Emacs 22

I can’t reproduce the problem any more. – DanielClemente

An other possible culprit is DVC, I think. I use mercurial and I see DVC invokes fmakunbound pretty frequently. Anyway, the problem haven’t yet occured here since the advise is active, so the hunt is still on.

I don’t think so; I have never used DVC and still got the error. – DanielClemente

There is now a long thread about this on the Emacs Devel mailing list: http://lists.gnu.org/archive/html/emacs-devel/2009-06/msg00490.html - I think it might be good to defadvice also make-symbol and unintern as above. Adding a post-command function like Thien-Thi suggested is also a good idea, because then it is easier to notice when the bad thing happened.

Thanks, I’ll add those too. Strangely, the bug didn’t occur today, although I used nxhtml-mumamo-mode with php all day. Previously the error occured quite often, several times a day. I’m starting to think the defadvice fixed it. :D

I just released 1.84 of nXhtml but I do not think there is anything new concerning this problem (but it probably fixes another problem for Emacs 22).

The problem failed to occured since then. Not that I’m complaining. :P I let the advice active anyway if it rears its ugly head again.

The bug is of course afraid since we are many that are hunting it…

I think it is gone … ;-)

*=================== End of Solved Problems ==================*

Unconfirmed problems

Conflict with flyspell in text-mode-hook

When I have ‘turn-on-flyspell’ included in my text-mode-hook, nxhtml spews out a rash of flyspell-related errors with every character typed.

Could you please give more information? Describe more in detail what you are doing. What error message do you get? What kind of file are you editing? What chunks are there?

I am not usually using flyspell myself so I need a bit help from you. I just tested in a XHTML file with just flyspell-mode and it works for me (using CVS Emacs 23 though).

BTW, I just added flyspell support. It will be in nXhtml 1.17

*=================== End of Unconfirmed Problems ==================*