I love emacs,

and I want to do my web-programming work in it,
but I can't find a way to get it to edit HTML properly.

I mean it's seriously awful.

It will do HTML fine, but not PHP, javascript, etc.

I tried getting html-helper-mode... I downloaded it, put it in /usr/local/share/emacs/site-lisp, and added it to my .emacs file:

(autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
  (setq auto-mode-alist (cons '("\\.html$" . html-helper-mode) auto-mode-alist))

copied and pasted from some site (I don't know elisp).
it just, doesn't highlight anything at all.

I tried downloading a whole bunch of modes and using some other mode to string them together, to no avail.

Emacs is so great in every other way--why can't it do the simple task of editing web pages? I mean, it's a pretty standard thing to do for editors these days.

So, does anyone know how to do this?

link|improve this question

feedback

4 Answers

up vote 4 down vote accepted

Have you checked out Emacs Wiki html page? nxhtml in particular looks useful.

link|improve this answer
2  
it looks useful but it's very painful to use... it loads slowly, doesn't indent properly, is ugly, runs slow, highlights everything red and then makes it all italic and just, is painful... – Carson Myers Aug 9 '09 at 3:15
1  
I've used nxhtml with success. Font colors and italics are all controllable by customizing the faces – Doug Harris Aug 27 '09 at 20:11
feedback

I've been dissatisified with the available modes, but I have found happiness recently using plain old html-mode augmented with yasnippet and tidy.el. As the other answers have mentioned nxhtml mode is useful if you are writing xhtml.

If you are wanting to get highlighted php and javascript, you might want to look at mmm-mode, which will allow you to run multiple major modes at once. I've never used it, so I don't know who it handles conflicting key bindings, etc... so you'll have to feel your way around there.

link|improve this answer
feedback

I too use nXhtml mode for mixed mode editing having failed to get Multiple Modes working correctly. It has been a bit of a rocky ride but recent builds have proved to be useful. I'm running with Emacs 23 FWIW.

link|improve this answer
feedback

Give multi-web mode a try, it's a minor mode designed with web editing in mind, it selects the appropriate major when the point moves around.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.