[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Changing Languages in a file
From: |
Anselm Helbig |
Subject: |
Re: Changing Languages in a file |
Date: |
Wed, 09 Sep 2009 09:41:37 +0200 |
Hi!
> I need to change languages within a file used for
> generating code in another language. For example,
> I might have a Python script generating C or C++
> code.
>
> The documentation tells me I can specify at the top
> of the file for the entire file, but I can't find a
> way to change this for sections of a file.
>
> Is there a way to do this?
This is currently a weak point of Emacs. It is built around the
assumption that each buffer has exactly one major mode at a time. Read
more about major modes here:
(info "(emacs) Major Modes")
There are some hacks to overcome this restriction, they are listed
here:
http://www.emacswiki.org/emacs/MultipleModes
However, setting one of these up can be a bit daunting, especially for
someone new to Emacs. IMO the cleanest and most practical solution
would be to keep your code generation templates in separate files.
HTH,
Anselm
--
Anselm Helbig
mailto:anselm.helbig+news2009@googlemail.com