Fork me on GitHub
#emacs
<
2017-12-04
>
hlolli10:12:35

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?

qqq10:12:16

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

hlolli10:12:04

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

qqq11:12:14

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

qqq11:12:30

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

dpsutton13:12:46

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

solf16:12:22

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)

solf16:12:03

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

solf16:12:26

Indirect buffers + narrowing is for me the best bet

solf16:12:56

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

dotemacs19:12:18

@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…

hlolli19:12:40

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