4

I use emacs when working with Django. .py files work great with Python-mode, .js files work great with js2-mode, .djhtml (templates) work great with django-html-mode -- except for Javascript blocks which aren't auto-indented nor highlighted.

Does anyone know of a way to get syntax-highlighting for Javascript blocks in Django templates in emacs?

1
  • Have you got MuMaMo? (Multiple Major Mode) Commented Mar 5, 2010 at 10:53

1 Answer 1

2

You can use django-nxhtml-mumamo-mode. It is part of the nXhtml package. (It is shipped with Emacs Starter Kit, too.) For JavaScript, it uses javascript-mode instead of js2-mode.

Sign up to request clarification or add additional context in comments.

2 Comments

Works great. Do you know how to stop the dratted chunk-colouring that nxhtml does? Related discussion here: stackoverflow.com/questions/1146701/…
Right, figured that one out myself, the answer is here: ourcomments.org/Emacs/nXhtml/doc/nxhtml.html#multi-colors

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.