help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Modes within modes


From: Gareth Rees
Subject: Re: Modes within modes
Date: 7 Nov 2003 09:27:46 -0800

Dan Anderson wrote:
> Often times I'll have an e-mail message with some code in it, or code
> with some text in comments.  Is it possible to highlight a region and
> tell Emacs to (use A-mode instead of B-mode)?

The simplest way to do this is to use 'clone-indirect-buffer' (C-x 4 c)
and use A-mode in the original buffer and B-mode in the cloned buffer.
Put the two buffers in adjacent windows and switch between them when you
want the features of the other mode.  See the Info node (emacs)Indirect
Buffers.

There are third-party add-ons that claim to support multiple major modes
in the same buffer (I don't know how they work, but if they have any
sense they will work by automatically switching to the appropriate
indirect buffer depending on the value of point).  See
http://www.emacswiki.org/cgi-bin/wiki?MultipleModes for a selection of
possibilities.

-- 
Gareth Rees


reply via email to

[Prev in Thread] Current Thread [Next in Thread]