To nXhtml main page

News and Notes about nXhtml

Thanks for testing!

I want to thanks the testers (who have been many now), especially to my first testers Hadron Quark and Eric Lilja, for helping me by testing and pointing out bugs and weaknesses, most of them related to editing of PHP.

Without testers all kind of problems I just can't imagine myself would still be there in nXhtml. For example Hadron told me once that he got the error (wrong-type-argument stringp nil). Eh, I replied, are you sure. Yes he was. I tried the same file as him. No error.

The error happened during fontification so the error message above was all we had. A real black box for me. Or perhaps black magic? After much confusion and some hard work we finally found out what it was and I implemented a better way to catch such errors. If Hadron would have given up the problem would still have been there. Some problems are just impossible to solve without good cooperation. So, again, thanks Hadron.

BTW, I will perhaps add some even better way to Emacs to catch these errors so other can benefit from our insights too, but that requires some time and effort which I can't afford right now.

The State of the Art

I have more and more come to realize that there are two main parts of nXhtml which are in a bit 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 difficult. There are also things to discover, for example in the interactions with other minor modes. Each minor mode actually have to be tested with mumamo-mode. (Instruction for library authors are in mumamo-mode.el)

That said I still think mumamo-mode is mature enough for serious use. At least the fontification now works ok I believe. Other parts that also depends on the major mode used, like filling and indentation have some quirks. To make those work more reliably in all cases a bit more standardisation across different major modes is needed. (It is perhaps possible to work around those problems in mumamo-mode, but the long term benefits of doing that are probably small.)

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 (ever) 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.

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

v0.89 v0.90 v0.91 v0.92 v0.93 v0.94 v0.95 v0.96 v0.97 v0.98 v0.99 v1.00 v1.01 v1.02 v1.03 v1.04 v1.10 v1.10 v1.10 v1.10 v1.10
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 fictive 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.
  • Fictive XHTML Validation Header:
    • Fictive XHTML Validation Header state was not saved when moving between chunks. Fixed.
    • Tried to make the concept of Fictive XHTML Validation Header more clear. Added this visually to the buffer.
    • Fictive 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).
  • Fictive XHTML Validation Header:
    • The Fictive XHTML Validation Header state were not saved when changing major mode in MuMaMo. Corrected.
    • Added more alternatives to the Fictive XHTML Validation Header list. This should make it easier to use completion with for example PHP.
    • Added default value for the Fictive XHTML Validation Header.
    • Tried to make the use of Fictive 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
  • Enhanced the documentation for nXhtml. Starting from C-h f nxhtml-mode it should now be easier to get an overview.
  • Bug fixes etc:
    • Completion on an empty page gave a faulty frameset page. Fixed.
    • Insert end tag did not work with a fictive validation header. Fixed.
    • Insert end tag when all preceding tags where closed gave a strange error message. Fixed.
    • Changed some key bindings to comply with (info "(elisp) Key Binding Conventions")
    • Completion in empty buffers with a completion header did not work. Fixed.
    • Multiple major modes:
      • Fixed a bug that prevented mumamo-global-mode from beeing turned on in a file opened in fundamental-mode.
      • Better error tracing for some functions, including the call of major mode functions.
      • Position was garbled when a ;-char was inserted in php-mode chunk. Fixed.
      • A bad check for if mlinks-mode where available was fixed.
      • Some bugs concerning turning off mumamo-mode was fixed.
      • Fixed a bug in perl here doc chunks. Suddenly the problem with slowness when using mumamo-mode in perl buffers seems gone. (Note quite sure, but I can't see any problems now.)
      • Fixed a bug in mumamo-mode when current buffer was switched before the major mode had been set from the current chunk.
      • Fixed a long standing bug in php fontification of strings and comments.
      • Fixed a bug where sgml-xml-mode was not defined.
      • Fixed a bug related to get-text-property which gives an error when buffer is narrowed.
      • Tried to refontify things outside of a narrowed part. Fixed.
      • Too little where refontified after changes. I hope I have fixed this.
    • Fictive XHTML Validation Header:
      • View File did not work correctly when a fictive XHTML validation header was used. Corrected.
      • Fictive XHTML validation headers are no longer turned on by default in any buffers.
    • Indentation:
      • Tried to fix a problem when using newline-and-indent. When this was in a mode derived from C the indentation sometimes became 0.
      • Speeded up the indentation of regions a bit when using mumamo-mode.
      • Indentation: TAB now only indents a region if it is visibly marked (see transient-mark-mode and cua-mode).
      • Simplified the indentation code.
    • Fixed a problem where string fontification got out of phase so that wrong parts of buffer could be fontified as a string.
    • Added a workaround for Attribute values computed by PHP
    • Added .nosearch to subdirectories with no elisp files.
    • Fixed incorrect checks for mlinks-mode in menu building.
    • File extensions where used in a case sensitive way in some places. Fixed.
    • appmenu: Worked only in html files. Fixed.
    • html-site: Fixed the error Error (html-site-current): Can't find site: your-site-name.
    • Fixed a problem with longlines-mode in the support for Firefox add-on It's All Text. (Note however that there are some bugs in longlines-mode itself.) Rewrote the support to be more general. It is now in the file as-external.el, see this file.
    • Fixed an encoding problem in tidy-buffer. Output from tidy was not read using the same coding system as tidy was using.
    • Fixed some problems with face definitions, possibly bugs (not sure).
    • Made the fontification faster when using mumamo-mode. (It is still slower than single mode fontification of course.)
    • nxml-where.el: Made it aware of mumamo.el.
  • Menu changes:
    • Completion menu: Renamed to Completion and Validation menu and reorganized a little bit to make it more clear.
    • Renamed view to browse since this is the normal emacs name for showing files in a web browser. Also made corresponding changes to function names. Put back the possibility to view only the region in a web browser.
  • Uploading:
    • Added remote dired to the menus.
    • Fixed problems with file names starting with ~.
    • Fixed more problems with file names with spaces.
  • nxml-where:
    • nxml-where now uses a timeout for more smooth performance.
    • nxml-where can now recognizes both id and name attribute.
    • Hyphens are now accepted in tag names.
  • 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 support for switching major mode dependent on if Emacs was called as an external editor. This makes it possible for example to switch to relevant major and minor modes when 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.
  • Filling:
    • Added functions for unfilling.
    • Added keybindings and menu entries for longlines-mode, fill-paragraph and unfill-paragraph.
  • Quoting: Added HTML quoting of & and < in text areas. Bound to C-c C-q.
  • Images:
    • 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.
  • Added nxml-untag-element.
  • Added a modified version of wikipedia-mode.el. Seems likely to be useful if you are doing web editing.
  • Added html-imenu.el
  • MuMaMo:
    • Removed the lighter "MuMaMo" for mumamo-mode. Instead the active major mode now has "/m" appended to mode-name (that is what you see in the mode line).
    • The normal way to turn on mumamo-mode has changed. There are now functions that you can use in auto-mode-alist to directly set up the buffer for mumamo-mode. The available functions are in the variable mumamo-defined-turn-on-functions.

      You are not supposed to call mumamo-mode yourself any more and mumamo-global-mode is gone. So is also mumamo-chunk-family-by-mode and mumamo-filenames-list. The functionality those gave are all replaced by the new functions for turning on mumamo mode.

    • Added support for buffer local values in hooks. This is necessary for example to support minor modes that are meant to be buffer local but not major mode specific. Instructions for authors of this kind of minor modes are in the file mumamo.el.
    • Added support for Django.
    • Added support for Embperl.
    • Added support for PHP Smarty. The {literal} ... {/literal} construct is not supported. This mean that you can not use <style ..> or <script ..>.
    • Added support for imenu for the main major mode. Turned on this by default in nxhtml-mode.
    • Made the temporary replacement of the attr="<?php ... ?>" a bit better. They are now more visible and also still mumamo chunks during the temporary replacement.
    • Added support for flymake-mode. Maybe add support for checking chunks?
    • Printing: Added htmlfontify.el and hfyview.el. These makes if possible to print a buffer fontified with mumamo-mode on in colors (through your web browser). There is an example of the capabilities of htmlfontify here (made with a little function in hfyview.el).
  • PHP:
    • Did a first merge with Aaron Hawleys fixes for php-mode.el.
  • CSS: Upgraded to Stefan's latest css-mode.el.
  • Fictive XHTML Validation Headers: Changed the way they are turned on. They may now be turned on when mumamo-mode is turned on.
  • Some users want to use their own patched version of nXml. Next version of Emacs will come with nXml. Therefore, the loading routine for nXhtml now checks if nXml is is already loaded. Thanks to Eric Lilja for testing this. Eric also made me aware of that if nXhtml was placed in the site-lisp directory tree then things did not work as I expected. I think I have corrected that by placing a .nosearch file at the top of the nxml tree in nXhtml.
  • Restructured the directories. Moved some files out of the nxhtml subdir. Some of them went into the util subdir (those are written by me) and some to the new subdir related (those that are inherited from others, maybe changed by me - most often to work with mumamo-mode).
  • Changed all licenses to be GNU GPL.
  • Additions to tidy support: It is now possible to use the tidy support to tidy the XHTML part of php etc. (Thanks to Hadron for this suggestion.)
  • Added winsize.el which allows interactive resizing of windows. Also added winsav.el which adds the capability to rotate window configurations and also to save window configuration to file.
  • Made nXhtml work with CVS Emacs 23.0.50.1.
  • Added freemind.el to the parcel. After all FreeMind supports web publishing too so why not have the Emacs support here ...
1.10
Just jumped the version number for the new release of nXhtml. There are really significant changes in this release, not only minor bug fixes.
1.11
Minor bug fixes to completion. Added fictive validation header to completion alternatives when buffer is empty and mumamo is used.
1.12
  • Fixed a bug in image link insertion in nxhtml-mode, thanks Niels Giesen!
  • Restructured, reordered and documented mumamo.el. It is now two separate files, mumamo.el and mumamo-fun.el.
  • Added move by chunk to the nXhtml menu.
1.13
  • Better handling of the case when no validation header is needed and the user tries to turn it on.
  • Added .phtml as php file.
1.14
  • Completion of links in XHTML was broken. Fixed, thanks to Niels Giesen.
1.15
  • Added `mumamo-map' keymap.
  • Added a keymap to all multi major modes.
  • Some more refinement to fictive validation headers.
1.16
  • Mumamo:
    • Changes to indentation:
      • Removed indent-region-mode since that functionality is now in indent-for-tab-command in Emacs 22.
      • Removed some code that checked if indentation was 0.
      • Added indent-for-tab-command to mumamo-map.
    • Reordering and renaming:
      • Reordered and move some functions in mumamo.el et al. Added new file nxhtml-mumamo.el.
      • Renamed define-mumamo-turn-on to define-mumamo-multi-major-mode.
      • Removed the ending -turn-on from the functions defined by the macro above.
      • Introduced multi major mode as a name for the functions defined by the macro above. Those works in many respects like major mode functions, but they support multiple major modes in a buffer.
    • Added support for noweb as multiple major mode.
1.17
  • Mumamo:
    • Added support for flyspell.
  • Bug fixes to the version of find-recursive.el that ships with nXhtml. Thanks to Cezar Halmagean.
  • Added tabkey2.el which tries to make it easy to use the Tab key for completion. (You must load it and turn on tabkey2-mode to use it.)
  • Folding:
    • Added nxhtml-heading-element-name-regexp as default for nxml style folding.
    • Some changes to fold-dwim.el.
  • AppMenu:
    • Simplified: Removed the possibility to automatically show minor and major mode menus. There is now only one list, appmenu-alist.
    • Added menu item At Current Point for bindings found in character and overlay keymaps at point. Those you always forget.
  • Physical line:
    • Added physical-line.el to nXhtml.
    • Added new functions to move to beginning and end of line to ourcomments-util.el that supports physical-line.el.
1.18
  • Better Tab completion in tabkey2.el.
1.19
  • Even better Tab completion in tabkey2.el.
1.20
  • Once again even better Tab completion in tabkey2.el.
  • Fixed bug in hiding of validation errors (they could disappear totally).
  • Cleaned up menus in nXhtml.
1.21
  • Added a bit support for dired (upload, browse, browse remote).
  • Fixed some strange menu problems (i hope).
1.22
  • Bug fix.
1.23
  • Bug fix.
1.24
  • Tried again to make hexcolor-mode more readable.
  • Mumamo:
    • Added support for hi-lock-mode. At present it might however be very puzzling. The hilight added by hi-lock-mode may be hidden by the overlays used by mumamo. Tip: you can always use the face hi-black-hb.
1.25
  • Mumamo:
    • Handle hi-lock-mode in a more general way using font-lock-mode-hook.
1.26
  • nxhtml-mode:
    • Removed the indent line patch for nxml-mode.
    • Better test for empty page during completion.
  • tabkey2-mode:
    • A lot of improvements.
1.27
  • Fixed a bug in html-site when comparing file names. File names where not made unique before comparision.
  • Fixed documentation and reordered code in mumamo.el and mumamo-fun.el.
  • Fixed a bug in mumamo concerning indentation. The desired indentation function replacement where not used.
  • Fixed tabkey2 bugs.
  • Changed javascript.el indentation to make it work with mumamo.el.
  • Introduced the function mumamo-make-variable-buffer-permanent as an aid for minor mode authors.
  • Made nXhtml menu available in sub-chunks.
  • Included a slightly changed version of Steve Yegge's js2.el + js2-fl-mode.el with support for jit-lock-mode. This support has some flaws and maybe js2 is not ready for use, I am not sure. However if you want to use this instead of Karl Landströms javascript-mode then please customize mumamo-major-modes.