Fork me on GitHub

Someone ever heard of the possibility of dual mode in single buffer, so say between lines 1-100 I'd want to write clojure code and from line 100-200 I'd want to write c code. Is this possible that when the cursor enters these lines, the mode would change?


@hlolli: org mode allows multiple languages in one file, but you have to delimit it using something ugly like #+ LANGUAGE ... or something


hmm ok, this statement would then cause syntax error when I'd compile it.


I'm sure the org mode line is configurable (so to embed it as a comment)


you can also use web/tangling, which will generate the snippets


Seem to be several ways including native indirect buffers. Have you tried any of these?


mmm-mode tries to solve the problem of multiple languages in one file, but since emacs really wasn't made with that in mind, it can be pretty buggy at times (haven't tried it in years though)


I haven't heard of the other third-party packages but I'm sure they probably have many quirks for the same reason than mmm-mode


Indirect buffers + narrowing is for me the best bet


Basically trying to emulate what org-mode babel does (using indirect buffers themselves surely)


@hlolli I’d look at how web-mode does it and try to get that going somehow to fit your use case. Not that C is web related, but web-mode seems to be the best support for multiple languages in a single buffer…


@dpsutton no I'll check @dromar56 thanks for the point @dotemacs I check it out thanks.