[Aquamacs-devel] html-helper-mode won't indent

Pete Siemsen siemsen at ucar.edu
Mon Sep 28 11:42:36 UTC 2009


On Sep 27, 2009, at 7:23 AM, David Reitter wrote:

> On Sep 27, 2009, at 2:09 AM, Pete Siemsen wrote:
>
>> Aquamacs 2.0 ships with html-helper-mode as the default mode for  
>> ".html" files.  The mode seems to basically work - syntax  
>> highlighting and special commands work as advertised.  Trouble is  
>> that indenting just doesn't work at all.  Instead of inserting the  
>> proper indentation, a TAB removes existing indentation.
>>
>> html-mode doesn't have the problem, but html-mode has far fewer  
>> features than html-helper-mode.
>
> So, what do you suggest?  Can you fix the indentation problem with h- 
> h-m?  That would be ideal.

Here's what I was able learn by Googling:

Html-mode was written by Marc Andreessen of Netscape fame.  It is  
documented in the GNU Emacs manual, so it must've been absorbed by GNU  
Emacs as the "standard" HTML mode.

Html-helper-mode was written later, by Nelson Minar.  It was inspired  
by html-mode.  The author wrote up the differences between the two  
modes, at http://www.santafe.edu/~nelson/tools/differences.html.   
Briefly:

html-mode                           html-helper-mode

older                               newer
                                     written to replace html-mode
built into GNU Emacs                a .el file
documented in GNU Emacs manual
limited                             lots of features
written by Marc Andreessen          written by Nelson Minar
simple syntax highlighting          better syntax highlighting
no templates                        templates via tempo.el

1. The html-helper-mode that comes with Aquamacs is version 1.5.   
Version 2.19 is available.  Version 1.5 has a much smaller set of  
commands, so at first glance you might conclude that html-helper-mode  
isn't much better than html-mode.

2. Html-helper-mode seems to indent poorly, but it will indent lists  
(<li> tags).  Perhaps the author of html-helper-mode only wanted  
indentation for lists.

3. A "solution" to the indenting problem is to call "tidy" to do  
sophisticated indenting/rewriting of your entire HTML buffer.  This is  
cool, but tidy does a lot more to the HTML than just reindenting.   
Fortunately, tidy comes with Mac OS X, so it's a good general solution  
for Aquamacs users.  This approach is
documented at http://blog.vagmim.com/2008/11/html-helper-mode-and-indentation.html

IMHO, html-mode is too rudimentary, even though it has nice  
indentation.  It would be possible to improve the indentation in html- 
helper-mode, with some effort, but it seems that the author intended  
it to produce mostly flat HTML.  I think the best approach is to load  
the latest html-helper-mode and add the hack to use tidy to indent the  
HTML.

-- Pete

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.aquamacs.org/pipermail/aquamacs-devel/attachments/20090928/910c2403/attachment-0004.htm>


More information about the Aquamacs-devel mailing list