From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?iso-8859-1?Q?Fran=E7ois?= Gannaz Newsgroups: gmane.emacs.help Subject: Re: Font-locking different "sections" in a file Date: Tue, 27 Jun 2006 23:20:49 +0200 Message-ID: <20060627212049.GF7683@free.fr> References: <1151433919.192433.175940@x69g2000cwx.googlegroups.com> Reply-To: help-gnu-emacs@gnu.org NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1151443296 21076 80.91.229.2 (27 Jun 2006 21:21:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 27 Jun 2006 21:21:36 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jun 27 23:21:25 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FvKzZ-0003NR-5r for geh-help-gnu-emacs@m.gmane.org; Tue, 27 Jun 2006 23:21:06 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FvKzY-0006D0-EW for geh-help-gnu-emacs@m.gmane.org; Tue, 27 Jun 2006 17:21:04 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FvKzL-0006Cv-Uk for help-gnu-emacs@gnu.org; Tue, 27 Jun 2006 17:20:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FvKzJ-0006Cf-7i for help-gnu-emacs@gnu.org; Tue, 27 Jun 2006 17:20:50 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FvKzJ-0006Cc-29 for help-gnu-emacs@gnu.org; Tue, 27 Jun 2006 17:20:49 -0400 Original-Received: from [194.158.104.39] (helo=relay-cm.club-internet.fr) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FvLBU-0000Pk-8A for help-gnu-emacs@gnu.org; Tue, 27 Jun 2006 17:33:24 -0400 Original-Received: from pandion (d02m-89-83-205-119.d4.club-internet.fr [89.83.205.119]) by relay-cm.club-internet.fr (Postfix) with ESMTP id 2EC5325619 for ; Tue, 27 Jun 2006 23:20:48 +0200 (CEST) Original-Received: from zamansky by pandion with local (Exim 4.62) (envelope-from ) id 1FvKzJ-0002KR-NP for help-gnu-emacs@gnu.org; Tue, 27 Jun 2006 23:20:49 +0200 Original-To: help-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: <1151433919.192433.175940@x69g2000cwx.googlegroups.com> User-Agent: Mutt/1.5.11+cvs20060403 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:35698 Archived-At: Maybe you could try to set multiple modes for your file. I only know mmm-mode, but similar extensions are available : http://www.emacswiki.org/cgi-bin/wiki/MultipleModes You could try something like : (mmm-add-group 'fancy-test '( (file-m :submode xhtml-mode ; choose your own mode :face mmm-code-submode-face ; light grey background :front "^FILE$" :back "^DATA$") (data-m :submode text-mode :front "^DATA$" :back "^FILE$") )) (add-to-list 'mmm-mode-ext-classes-alist '(text-mode nil fancy-test)) Hope that helps. -- Fran=E7ois Le mar 27 jun 11:45, wisnij@gmail.com a =E9crit : > 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: >=20 > # some header information > import(foo) > import(bar) >=20 > TEXT > some paragraphs of &{marked-up text} > etc etc >=20 > DATA > # tab-separated data >=20 > ...and so forth. Which is to say, the only delimiter between > different sections is the tokens "TEXT", "DATA", etc. on lines by > themselves. >=20 > 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. >=20 > 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? >=20 > _______________________________________________ > help-gnu-emacs mailing list > help-gnu-emacs@gnu.org > http://lists.gnu.org/mailman/listinfo/help-gnu-emacs >=20