I am using org-mode babel to take notes. I am using source code blocks to write down examples of html interspersed with javascript. I take the notes in a subtree within a pretty big document.

Now, when I edit the source code block I would like to use web mode to have automatic indentation and auto-complete etc. However, somewhere in the document is an unmatched expression, so web-mode will complain. There is no way I will find the unmatched expression (or want to actually).

Is there a way to use web-mode localized so to speak, e.g. only within the source code block? Or could I actually configure org-mode to automatically recognize the language of the source code block and switch modes accordingly w/o having to change manually?

  • 1
    Try C-c ' (org-edit-special).
    – NickD
    Commented Mar 13, 2021 at 12:59
  • No, same issue. 'search failed: there is an unmatched expression....' So it seems that org-edit-special takes the whole document as scope
    – mor3dr3ad
    Commented Mar 13, 2021 at 13:59


Your Answer

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

Browse other questions tagged or ask your own question.