emacs-devel
[Top][All Lists]
Advanced

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

Re[2]: Multiple major modes


From: Eric M. Ludlam
Subject: Re[2]: Multiple major modes
Date: Tue, 12 Jun 2007 16:14:20 -0400

  [ ... ]
>>> "Lennart Borgman (gmail)" <address@hidden> seems to think that:
>Stefan Monnier wrote:
>>> and something that should be addressed without imposing restrictions on
>>> specialized major modes.
>> 
>> Actually, I think that in order to address it well, we will need to impose
>> restrictions on major modes (though only on the ones involved in
>> multiple-major-mode buffers) and maybe also on minor modes.

My parsing tool (semantic, referenced earlier) solved some problems w/
lots of mode-specific configurations via 'mode-local' variables and
methods.  David Ponce wrote this, and suggested it here once before.
I don't recall what the end resolution was on it.

A multi-mode style thing would likely be simplified if key behaviors
were all defined via mode-local configurations, as that would allow
the multi-mode manager to get a complete query list of all
configuration differences without running the major-mode function.

http://cedet.cvs.sourceforge.net/cedet/cedet/common/mode-local.el?view=log

This tools has a spiff macro `with-mode-local', which lets you run a
bunch of code as if some other mode were active.  This is used in our
grammar file so we can operate on grammar syntax w/ lisp syntax mixed
in.  We can also operate on tags from other buffers by momentarily
using features of the originating major-mode.

Enjoy
Eric


>I think so to. I have seen some areas where some form of coherence is 
>necessary:
>
>- fontification
>- indentation
>- parsing
>
>I think nxml-mode is a very good candidate for those that can be used in 
>a multiple-major-mode buffers, since a mix of for example XHTML and PHP 
>is common.
>
>This might seem impossible, since such code could not be valid XHTML. 
>Actually it is not, the rng parser used in nxhtml-mode is quite good on 
>guessing an apropriate state for completion. (But do not ask me what the 
>rng parser does, I do not understand it.)
>

-- 
          Eric Ludlam:                 address@hidden, address@hidden
   Home: http://www.ludlam.net            Siege: www.siege-engine.com
Emacs: http://cedet.sourceforge.net               GNU: www.gnu.org




reply via email to

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