all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Modes within modes
@ 2003-11-06  0:52 Dan Anderson
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Anderson @ 2003-11-06  0:52 UTC (permalink / raw)


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 ___ mode instead of ____ mode)? 

Thanks in advance,

Dan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Modes within modes
       [not found] <mailman.3281.1068080002.21628.help-gnu-emacs@gnu.org>
@ 2003-11-07 17:27 ` Gareth Rees
  2003-11-07 18:01   ` Kevin Rodgers
  2003-11-07 20:52   ` Peter Lee
  0 siblings, 2 replies; 5+ messages in thread
From: Gareth Rees @ 2003-11-07 17:27 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Modes within modes
  2003-11-07 17:27 ` Gareth Rees
@ 2003-11-07 18:01   ` Kevin Rodgers
  2003-11-07 18:29     ` lawrence mitchell
  2003-11-07 20:52   ` Peter Lee
  1 sibling, 1 reply; 5+ messages in thread
From: Kevin Rodgers @ 2003-11-07 18:01 UTC (permalink / raw)


Gareth Rees wrote:

> 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.

Wow, that is really cool!  Especially if you narrow each buffer to show just
the parts relevant to that mode.

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Modes within modes
  2003-11-07 18:01   ` Kevin Rodgers
@ 2003-11-07 18:29     ` lawrence mitchell
  0 siblings, 0 replies; 5+ messages in thread
From: lawrence mitchell @ 2003-11-07 18:29 UTC (permalink / raw)


Kevin Rodgers wrote:

[...] Indirect buffers

> Wow, that is really cool!  Especially if you narrow each buffer to show just
> the parts relevant to that mode.

As in <URL: http://www.emacswiki.org/cgi-bin/wiki.pl/IndirectBuffers>?

Now, if only there were a way to have a "super-buffer", created
out of multiple other buffers, mmm-mode would be a lot easier to
write :).
-- 
lawrence mitchell <wence@gmx.li>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Modes within modes
  2003-11-07 17:27 ` Gareth Rees
  2003-11-07 18:01   ` Kevin Rodgers
@ 2003-11-07 20:52   ` Peter Lee
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Lee @ 2003-11-07 20:52 UTC (permalink / raw)


>>>> Gareth Rees writes:

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

This method seems to partially work.  I can clone an html buffer (in
html mode) and switch to the cloned buffer and issue M-x text-mode.
The modes are correct for each buffer however they seem to share
fontification.

So if I do M-x font-lock-fontify-buffer while in the text-mode buffer
I see the changes in both.  Same if I issue the command in the
html-mode buffer... the text-mode buffer then gets fontified for html.

I'm using cvs, so perhaps it's just my version.  If this is a known
limitation of clone-indirect however, then it wouldn't be as useful a
method for multiple modes (at least for me).

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-11-07 20:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-06  0:52 Modes within modes Dan Anderson
     [not found] <mailman.3281.1068080002.21628.help-gnu-emacs@gnu.org>
2003-11-07 17:27 ` Gareth Rees
2003-11-07 18:01   ` Kevin Rodgers
2003-11-07 18:29     ` lawrence mitchell
2003-11-07 20:52   ` Peter Lee

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.