How do I configure emacs for editing HTML files that contain Javascript?

Posted by MakeDummy on Stack Overflow See other posts from Stack Overflow or by MakeDummy
Published on 2010-12-16T15:28:07Z Indexed on 2010/12/26 19:54 UTC
Read the original article Hit count: 248

Filed under:
|
|
|

I have started the painful first steps of using emacs to edit an HTML file with both HTML tags and javascript content. I have installed nxhtml and tried using it - i.e set up to use nxhtml-mumamo-mode for .html files. But I am not loving it. When I am editing the Javascript portion of the code the tab indents do not behave as they do when editing C/C++ code. It starts putting tabs within the line and if you try and hit tab in the white space preceding a line it inserts the tab rather than re-tabifying the line.

Another aspect that I don't like is that it doesn't do syntax colouring like the usual C/C++ modes do. I much prefer the behaviour of the default java-mode when editing HTML files but that doesn't play nicely with the HTML code. :-(

1) Is there a better mode for editing HTML files with Javascript portions?

2) Is there a way to get nxhtml to use the default java-mode for the javascript portions?

Regards,

M

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html