In org-mode when the point is inside an ex or src block, I can ppress C-c ' to edit the section in another window in the respective major-mode with correct indenting and highlighting. I would like to reuse this functionality to make editing HTML easier.
Before anyone brings up MMM-mode, mumamo, etc. They don’t work for me. If anyone knows how to get indentation and font-locking working right in a multi-mode setup, I’ll gladly look into that as well.
Requirements (most of this is exactly what org-edit-special does:
- when in
<script>and<style>block, open block in indirect buffer in the proper respective major-mode. - an overlay is added to the original HTML buffer to show that this section is being edited.
- assume the original indentation of the first line is correct, and pad the whole block with that many spaces when editing is finished.
Does anyone know of a similar usage of org-mode? It seems imminently feasible.
I cannot say how well this would work for you (it was only just posted to the mailing-list today) but this thread on the mailing list may provide you with the solution.
It is supposed to do exactly what you describe, lacking only the regexps to properly define the code blocks perhaps (to extend it to fit the filetype you’re working with)