To nXhtml main page

News and Notes about nXhtml

Thanks for testing!

I want to thanks the testers, especially Hadron Quark and Eric Lilja, for helping me by testing and pointing out bugs and weaknesses, most related to editing of PHP.

It is quite a big job trying to get rid of smaller annoying bugs and bigger ones. In my mailbox folder for nXhtml I have more than 500 old messages currently.

The State of the Art

I have more and more come to realize that there are two main parts of nXhtml which are in quite different degrees of maturity. The reason for the difference is mainly that one of them, mumamo-mode, requires very tight integration with Emacs in a way that currently is not completely possible. Some things must be changed in Emacs for this. There are also things to discover in the interactions with other minor modes for example.

That said I still think mumamo-mode is mature enough for serious use (though it sometimes conflicts with some other modules).

The other part, nxhtml-mode, is more mature, since it stands more by itself and since it builds on the very stable nxml-mode. I would not say nxhtml-mode is finished, but it is stable and useful.

Magic major mode selection

Sometimes the major mode that Emacs opens a file in is not what you expect. This can happen with files like PHP files. The reason might be that magic-mode-alist have choosen a mode based on the content of the file. The way this is done does not take files with mixes a mix of for example XHTML and PHP into account.

You may try setting magic-mode-alist to nil if this is a problem for you.

This is now no longer necessary since the introduction of magic-fallback-mode-alist in CVS Emacs on 2007-05-16. (If you have an Emacs newer than that, of course.)

Long Red Underlines

Because of a bug in Emacs 22.1 you can sometimes (at the end of a line) get long red lines instead of just a single underlined character. Many users (me included) find this quite a bit disturbing. I have therefore added a command to quickly hide/show the underlines. This is on C-c C-w.

This is particular useful for example in the case where you edit a PHP file and are bound to get a lot of XHTML validation errors.

Attribute values computed by PHP

If you want to have attribute values computed by PHP here is a way how to structure that to avoid breaking completion and validation in the XHTML part unnessecary:

<img src="images/linux.png" title="<?php foo("bar");?>"/>

Unfortunately that still breaks XHTML validation since < is not allowed in strings. In the long run I believe the XML validator has to be broken up so that it avoids parsing the string here (in PHP files).

For now I have implemented a workaround. If you are using constructs like those above then turn on nxhtml-strval-mode. This will temporarily replace the above with

<img src="images/linux.png" title="«?php foo("bar");?»"/>

However on the screen you will still see the original string and when writing to file the correct characters will be used.

A note for PHP and its cousins

The rules for a process instruction in XML, like <?php ... ?> says that the text can contain any text except ?>. So if you want to output that string from PHP then break it up so it does not look as ?> in the source file.

It might be good to break up the beginning part of the process instructions too. And please note that to use XHTML validation or completion you should avoid using < in strings, since it is not allowed there.

Perl Mode slow with Mumamo Mode

Perl mode used with MuMaMo mode sometimes makes the fontification slow for big files. I do not know the reason, but I am trying to find a solution for this. If you encounter this problem, just turn off mumamo-mode in that buffer.

Tab width

Do you have tab-width to something different than 8 (the default)? Then please change this to 8. I have got reports of problem with indentation when it is not 8.

Why the chunks are not compatible with mmm

Some people have asked why the way to specify chunks in mumamo-mode is not compatible with the old mmm-mode. The answer is that I was not sure that the way used in mmm-mode for specifying the chunks was flexible enough.

And I am sure that even the way used in mumamo-mode is not good enough for all cases, but I let it be the way it is until I have a better understanding of the problem. Suggestions and comments are welcome!

nXhtml Changes

0.89
  • Corrected autostart for nXhtml when not used together with EmacsW32.
0.90
  • Improved display of XML path.
  • Discontinued xmple-mode.
  • New major modes nxhtml-part-mode/nxml-part-mode replaces minor mode xmlpe-mode. (While moving the code to nxhtml-part.el I also fixed a bug in Xmple minor mode that made Emacs take 99% of the CPU.)
0.91
  • Fixed some calls to perl which prevented uploading of a site of you did not have perl in the same location as me.
  • Glued together things so that editing PHP files works as I intended. (This means that Emacs switches between php-mode and nxhtml-part-mode automatically when moving point. And that you can use completion.)
  • Starting working on the documentation for nXhtml. New layout to the documentation files. Examples with images.
0.92
  • Fixes to make the switching between php and xhtml style editing work better.
0.93
  • Better error handling when switching to editing embedded JavaScript and CSS.
  • Removed PHP spec from embedded switching since they interfered with the automatic switching between php and xhtml.
  • Gives an error message if web host is not defined in site when trying to use View Uploaded File and cousins.
  • Gives a ready message when finished uploading a single file.
  • When using Mode Switching at <? ... ?> mode switching could occur in wrong buffer. Fixed together with some other buffer problems.
0.94
  • Add http://www.w3.org/ to the help sites for CSS.
  • Included a CSS mode.
  • Added a menu entry for bug reporting.
  • Renamed menu bar entry from XHTML to nXhtml for clarity. (But nXml menu bar entry is still called XML.)
  • Added work around for globalized minor modes in the cases of MLinks, XML Path and mode switching at <? ... ?>.
0.95
  • Added workaround for the problem with the first keyboard key after automatically switching of mode at <? ... ?>.
0.96
  • Added support for multiple major modes with mumamo.el.
  • More conventient handling of links. They can now be opened in the same window, 'other window' or in a new frame.
0.97
  • Schema was not setup after starting new page so completion did not work. Fixed.
  • Added http://xhtml.com/ to help sites for XHTML.
  • Added the concept of XML validation headers. These are just text parsed by the nXml validation parser to get a start state before starting parsing a buffer. This allows the use of the nXml completion in buffers where there are no XML header. Such a header is often lacking for example in PHP code since the XHTML header is often generated dynamically.
  • Because of the change above nxhtml-part-mode is no longer needed and is therefore declared obsolete.
  • Corrected a bug in mlinks.el that prevented opening an HTML link in a other window or a new frame.
  • Added support for JSP, eRuby and some support for perl in mumamo.el.
0.98
  • Mumamo was not found when nXhtml was installed with just the zip file. Corrected. (nXhtml is also installed when you install EmacsW32.)
  • Enhancement to mumamo error handling when a bad mode specifier for an embedded mode is found.
  • Introduced a bug for empty XHTML documents in 0.97. Corrected.
  • Corrected a bug for chunks 1 character long.
  • There is what I consider is a bug in Emacs 22.1 in the handling of global minor mode that are not distributed with Emacs. If they are turned on by customization, but loaded after Emacs have loaded the customizations (usually in .emacs) then they are not turned on correctly. Added work-around for this.
  • Extra XHTML Validation Header:
    • Extra XHTML Validation Header state was not saved when moving between chunks. Fixed.
    • Tried to make the concept of Extra XHTML Validation Header more clear. Added this visually to the buffer.
    • Extra XHTML Validation Headers can now be turned on automatically based on file name.
  • nXhtml menu:
    • Reorganized the nXhtml menu.
    • Added customization groups for help libraries to nXhtml.
    • Added an entry for customization of nXhtml to the menus.
    • Added Tidy to the menus again.
  • Corrected bug in XML Path (nxml-where) for single tags. Other small fixes to nxhtml-where.
  • Documentation enhancements. Added The Quick Guide.
0.99
  • Fixed a serious bug in the cooperation between nxhtml-mode and mumamo-mode.
  • Turn on mumamo-mode by file name (mumamo-global-mode).
  • Extra XHTML Validation Header:
    • The Extra XHTML Validation Header state were not saved when changing major mode in MuMaMo. Corrected.
    • Added more alternatives to the Extra XHTML Validation Header list. This should make it easier to use completion with for example PHP.
    • Added default value for the Extra XHTML Validation Header.
    • Tried to make the use of Extra XHTML Validation Header more automatic and therefore useful. Also tried to make it play better with setting schema file. (There is no need normally to set schema file by hand.)
    • To turn this on by default customize nxhtml-global-validation-header-mode.
  • Possible to hide validation warnings without turning on validation (which would make completion in the XHTML part impossible).
  • Some fixes to php-mode:
    • Using the character # for comments now works for most cases.
    • Now uses the fontification faces in a more standard way which calms down the look.
    • Initialization bug fixes.
    • Renamed php-mode-user-hook to php-mode-hook to follow standard.
  • Indentation fixes:
    • Various corrections to indentation in mumamo.
    • Added the possibility to use TAB to indent regions (indent-region-mode).
    • Warn about bad indentation in mixed PHP/HTML code when using php-mode only.
  • Fontification now fontifies all text first in main major mode and thereafter applies submodes. (This avoids some problems with around a submode chunk.)
  • Reorganized the nXhtml menu:
    • There is now a minor mode for the nXhtml menu. This makes it possible to easier use common features when in buffers not in nxhtml-mode.
    • The nXhtml menu does not disappear when moving into a chunk where the major mode is not nxhtml-mode. The changes also makes it easy to access uploading functions functions etc from other modes than nxhtml-mode since the nXhtml may also be shown in them.
    • The nXhtml menu can be turned on globally by default. Customize nxhtml-menu-mode for that.
1.00
  • Reached version number 1.00 - which you maybe believe means the bugs should be gone? Sorry, it is just that I ran out of version numbers ;-) However it looks like much fewer bugs at least.
  • Fixed problems mostly related to global turn on of different features in nXhtml.
  • Small fixes to indentation.
    • nxhtml-mode could get confused by php tags.
    • nxhtml-mode did not indent <!DOCTYPE in a sensible way.
    • Electric keys now works in embedded php when using mumamo-mode.
  • Tidy was very misbehaving since the output buffer was not erased between different files. But I have got no bug reports on this ;-)
  • Fixed a bug in validation that should up when using muamo-mode.
  • Fixed bug in <script ...> and <style ...> chunk dividing.
  • Added support for OpenLaszlo.
  • Corrections to mlinks-mode (visible mostly as links in XHTML buffers):
    • Links disappeared when a new file was opened. Corrected.
    • Links were not correctly updated at changes in the buffer when mumamo-mode was used. Fixed.
  • The welcome message for nXhtml could be shown too early sometimes when loading, before nXhtml actually knew if it should be shown or not. Tried to fix it.
1.01
  • Reported wrong version number for nXhtml in the menus. Fixed.
  • If you use the zip file to install nXhtml please notice that it has now a top level nxml. Sorry for not having zipped it like that before!
  • The url links in Welcome to nXhtml was a bit incorrect and did not work on all OS:es. Fixed.
  • Added customization of popup completion to the 'nxhtml customization group so they are easier to find.
  • MuMaMo
    • Struggled a bit with the load sequences of the elisp libraries used by nXhtml when using MuMaMo.
    • Tried to get the global turn on of mumam-mode to work in all cases.
    • The screen was blinking when changing overlays after changes in the buffer. Tried to fix this.
    • Minor fixes do syntax highlighting, like taking care of single ':s.
    • Fixes to the support for JSP and eRuby.
    • Made the support for perl here documents a bit better. Large perl documents are however still quite slow when using mumamo-mode. I do not know the reason yet.
    • Refontification could miss some parts when buffer changes caused chunk division changes. Complex, tried to fix it, but I am a bit unsure that it always works.
    • Cleaned up mumamo.el a bit.
    • Rewrote mumamo-test.el and functions called from it in mumamo.el a bit to make tracebacks from errors more useful. Changed keybindings in mumamo-test.el from global to a minor mode mumamo-test-mode. Renamed mumamo-notest.el to mumamo-test.el. Added it to the zipped distribution of nXhtml.
  • Fixed a bug related to links and buffer changes.
1.02
  • Fixed a refontification bug that occured after changes.
1.03
  • Added the possibility to call GIMP.
  • Reworked the messages for fontification errors to try to catch an error that shows up sometimes. Tried to avoid disturbing normal use in spite of that error.
  • Reverted to using a short delay before switching major mode when moving between buffers.
1.04
  • Completion in empty buffers with a completion header did not work. Fixed.
  • Multiple major modes:
    • Better error tracing for some functions.
    • Position was garbled when a ;-char was inserted in php-mode chunk. Fixed.
  • Extra XHTML Validation Header:
    • View File did not work correctly when an extra XHTML validation header was used. Corrected.
    • Extra XHTML validation headers are no longer turned on by default in any buffers.
  • Tried to fix a problem when using newline-and-indent. When this was in a mode derived from C the indentation sometimes became 0.
  • Added a workaround for Attribute values computed by PHP
  • Ruby
    • Multiple major mode turned on by default for .rhtml files when this mode is global.
    • Multiple major mode is no longer turned on when rub-mode is turned on.
  • Added .nosearch to subdirectories with no elisp files.
  • Added support for Firefox add-on It's All Text.
  • Added the possibility to easily view the output of scripts on the server (if they require no parameters). You can now do that from the nXhtml menu. Previously only html files on the server could be viewed that way. Image files can also be viewed this way.
  • Upgraded htmlize.el to version 1.34
  • Added functions for unfilling.
  • Added keybindings and menu entries for longlines-mode, fill-paragraph and unfill-paragraph.
  • Added image-mode to those that are encompassed by nxhtml-global-minor-mode so that images can be uploaded more easily.
  • Added edit with GIMP and upload to the popup menu for links. This avoids the need to load the linked files in Emacs first.
  • Fixed incorrect checks for mlinks-mode in menu building.