unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: font-lock and fontifying the few first nonempty lines in a buffer
Date: Thu, 26 Jun 2003 17:26:29 -0600	[thread overview]
Message-ID: <3EFB8125.6090600@yahoo.com> (raw)
In-Reply-To: rZIKa.13688$mU6.15106@newsb.telia.net

Ulf Andersson wrote:

 > I'm trying to write a major mode for Emacs, that need to fontify the few
 > first nonempty lines in the buffer. The mode do some other coloring in
 > addition to this, and that works OK. So far I have experimented with
 > `after-change-functions' and function matchers in `font-lock-keywords',
 > but all I manage to do is sending my Emacs into an infinite loop deep
 > down inside. I have to kill it from outside to get out of the lockup.
 >
 > I am using emacs 21.2.1 in a Windows 2000 environment.
 >
 > Has anyone already done somthing similar?
 > Is there an `obvious canonical way' to do this?
 > Is this downright impossible to do using `font-lock'?

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\\}"

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

  reply	other threads:[~2003-06-26 23:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-26 20:47 font-lock and fontifying the few first nonempty lines in a buffer Ulf Andersson
2003-06-26 23:26 ` Kevin Rodgers [this message]
2003-06-27 10:43   ` Ulf Andersson
2003-06-27 12:44     ` Kai Großjohann
2003-06-27 14:41       ` Ulf Andersson
2003-06-27 15:15         ` Kai Großjohann
2003-06-27 16:54     ` Stefan Monnier
2003-06-28  1:01       ` Sandip Chitale

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3EFB8125.6090600@yahoo.com \
    --to=ihs_4664@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).