Change Emacs modes within specific tags
OK, I know you're going to point me to EmacsWiki page, but here's the deal. I'd like to use the default Emacs mode for a given file type, and change mode after specific tag, say <% %>
. By d开发者_如何学JAVAoing such, I can switch the mode inside the tags, and return to default mode when cursor is not inside tags.
And no, I don't need ASP/PHP mode, it just that I find boring M-x
-ing all the time in order to change the mode. I'm using Emacs 23.2.1 on Arch Linux FWIW. Any ideas?
Have a look at mmm-mode: http://sourceforge.net/projects/mmm-mode/ or noweb-mode. Here are instructions for getting mmm-mode to work with literate Haskell documents. And here is the configuration I use for noweb-mode with literate (rst+python) Python documents.
nXhtml
nXhtml is an addon to Emacs for editing XHTML, PHP and similar things.
nXhtml comes with MuMaMo (Multiple Master Major Mode), which I think is a newer version of mmm-mode
. I use it all the time when editing Django HTML files which combine CSS, JavaScript and Django-aware HTML modes.
Is it what are you looking for :
http://www.emacswiki.org/emacs/PhpMode#toc8
You probably want to adapt it to fit your need
精彩评论