Cezar Halmagean wrote:
I wonder what's the problem, why has an editor like TextMate gone so far in just a few years and Emacs is still not there yet.
You might try “html-helper-mode”. I don't think it'll beat any major editor that do HTML, but it somewhat helps because by default it does syntax coloring various languages that are used together with HTML.
(of course emacs fans will tell you about several elisp code on the wild that do multi modes, but the sheer fact to shop around, install, get them to work is a pain and rather not trivial. for those interested, see http://www.emacswiki.org/cgi-bin/wiki/MultipleModes )
I think to have emacs work with today's web dev needs out of the box is one of the most important need for emacs. 〔➤see Modernization of Emacs〕
Even for working with pure static HTML pages, emacs's default HTML mode is quite lacking. The default HTML mode in emacs 22 (released in 2007), is at a level of ≈1998's commercial HTML editors. (of course emacs has redeeming qualities, i.e. its elisp system and all, that keeps us still sticking with emacs)
One trick i do when i need proper syntax coloring, is just to switch to that lang's mode. For example, if i'm working in a PHP segment, i just switch to PHP mode. You can assign single-press keys to switch to different modes.
One could guess why emacs doesn't have a robust mode for working with today's HTML. My guess is that it's a bit hard to write such a “mixed” mode possibly due to emacs infrastructure for modes, and of course because there are relatively very few emacs developers, and there's not a good tutorial on how to write a emacs mode (it involves quite a lot elisp knowledge in several areas. I'm currently picking it up and hope to write a tutorial soon).
Michael Schuerig wrote:
That's one of the emacs major problem today.
Basically currently there's no solution. “js2-mode” have some problems working with several of the multi mode thing.
Your current work around is:
non of the above is robust.
The “nxhtml-mode” attempts to fix the HTML multi-language problem from the ground up, based on the “nxml-mode” and some multi-mode mechanism called something like mumbo-ma-muu.
The “html-helper-mode” is a basic attempt to have a mode that just works with the multi-lang nature of HTML.
none of the above i have much experience. They are too much headache to install, or dig into.
also, there are Ruby modes that are designed specifically for mixed Ruby ＆ HTML. Search for Ruby On Rail something.