help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: font-lock and fontifying the few first nonempty lines in a buffer


From: Ulf Andersson
Subject: Re: font-lock and fontifying the few first nonempty lines in a buffer
Date: Fri, 27 Jun 2003 10:43:30 GMT

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" <address@hidden> wrote in message
news:address@hidden
>
> 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 via email to

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