From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Ulf Andersson" Newsgroups: gmane.emacs.help Subject: Re: font-lock and fontifying the few first nonempty lines in a buffer Date: Fri, 27 Jun 2003 10:43:30 GMT Organization: Telia Internet Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <3EFB8125.6090600@yahoo.com> NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1056710984 29310 80.91.224.249 (27 Jun 2003 10:49:44 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 27 Jun 2003 10:49:44 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Fri Jun 27 12:49:43 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19VqnW-0007ca-00 for ; Fri, 27 Jun 2003 12:49:42 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Vqkg-0006nw-EK for gnu-help-gnu-emacs@m.gmane.org; Fri, 27 Jun 2003 06:46:46 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!news.tele.dk!news.tele.dk!small.news.tele.dk!news100.image.dk!newsfeed101.telia.com!nf02.dk.telia.net!news-stob.telia.net!telia.net!217.209.241.173.MISMATCH!masternews.telia.net.!newsc.telia.net.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 52 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4920.2300 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4920.2300 Original-NNTP-Posting-Host: 62.20.172.150 Original-X-Complaints-To: abuse@telia.com Original-X-Trace: newsc.telia.net 1056710610 62.20.172.150 (Fri, 27 Jun 2003 12:43:30 CEST) Original-NNTP-Posting-Date: Fri, 27 Jun 2003 12:43:30 CEST Original-Xref: shelby.stanford.edu gnu.emacs.help:114779 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:11272 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:11272 Thank's Kevin for the sugestion. I realise that I failed to mention everything. I'm sorry. The text header consists of the first nonempty lines in the buffer. The header is followed by at least one empty line. I tried to use a slightly modified version of your regexp, "\\`\\(\\(.+\n\\)\\{1,7\\}\\)\n" And it does indeed color the header correctly some times, but not always. The documentation for font-lock also says that "keywords", i.e. regexps in the `font-lock-keywords' variable, should not span several lines, as this is "unreliable", to use the Elisp manual's word. This lead us back to square one, I'm afraid. Best regards to you all. /Ulf Andersson "Kevin Rodgers" wrote in message news:3EFB8125.6090600@yahoo.com... > > If you need a regexp that matches 3 non-empty lines at the beginning of > the buffer: > > interactively > programatically > ------------- > --------------- > \`\(.+ C-q C-j \)\{3\} "\\`\\(.+\n\\)\\{3\\}" > > (If you need a regexp that matches the first 3 lines in the buffer, > replace + by *.) > > If you need a regexp that matches the first 3 non-empty lines in the buffer: > > interactively > programatically > ------------- > --------------- > M-< > (goto-char (point-min)) > \(^$\)*\(.+ C-q C-q \)\{3\} "\\(^$\\)*\\(.+\n\\)\\{3\\}" > > -- > Kevin Rodgers >