From: Anselm Helbig <anselm.helbig+news2009@googlemail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Changing Languages in a file
Date: Wed, 09 Sep 2009 09:41:37 +0200 [thread overview]
Message-ID: <87my54d0p9.wl%anselm.helbig+news2009@googlemail.com> (raw)
In-Reply-To: <mailman.6255.1252454488.2239.help-gnu-emacs@gnu.org>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 967 bytes --]
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
next parent reply other threads:[~2009-09-09 7:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.6255.1252454488.2239.help-gnu-emacs@gnu.org>
2009-09-09 7:41 ` Anselm Helbig [this message]
2009-09-09 12:46 ` Changing Languages in a file Colin S. Miller
2009-09-08 20:01 Jonathan Seng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87my54d0p9.wl%anselm.helbig+news2009@googlemail.com \
--to=anselm.helbig+news2009@googlemail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).