[Top][All Lists]

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

Re: Font-locking different "sections" in a file

From: François Gannaz
Subject: Re: Font-locking different "sections" in a file
Date: Tue, 27 Jun 2006 23:20:49 +0200
User-agent: Mutt/1.5.11+cvs20060403

Maybe you could try to set multiple modes for your file. I only know
mmm-mode, but similar extensions are available :

You could try something like :

    :submode xhtml-mode         ; choose your own mode
    :face mmm-code-submode-face ; light grey background
    :front "^FILE$"
    :back "^DATA$")
    :submode text-mode
    :front "^DATA$"
    :back "^FILE$")
(add-to-list 'mmm-mode-ext-classes-alist '(text-mode nil fancy-test))

Hope that helps.

Le mar 27 jun 11:45, a écrit :
> We have a file format at my company which is almost free-form ASCII
> with some markup, but it can get hairy enough that I am obliged to
> write an Emacs mode with font-locking to help with editing it.  The
> problem is, files are broken into sections kind of like this:
>     # some header information
>     import(foo)
>     import(bar)
>     TEXT
>     some paragraphs of &{marked-up text}
>     etc etc
>     DATA
>     # tab-separated data
> ...and so forth.  Which is to say, the only delimiter between
> different sections is the tokens "TEXT", "DATA", etc. on lines by
> themselves.
> Each section differs slightly some the others syntactically: certain
> tokens are keywords in the header section but not elsewhere; one can
> normally start a comment with #, except within the TEXT block where it
> is just a normal character; and so forth.  There can still be
> structure within that block, though, so it doesn't feel like calling
> it all a string or comment is really the right way to go.
> I've looked through the manual but I didn't really see anything
> helpful, apart from the admonition not to use font-lock-keywords for
> multi-line constructs.  Is there an accepted way to define syntactic
> "block" within a file like this?
> _______________________________________________
> help-gnu-emacs mailing list

reply via email to

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