[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Multi-line font-lock parser
From: |
Thierry Volpiatto |
Subject: |
Re: Multi-line font-lock parser |
Date: |
Tue, 11 Aug 2009 09:55:39 +0200 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux) |
Teemu Likonen <tlikonen@iki.fi> writes:
> On 2009-08-11 07:48 (+0200), Thierry Volpiatto wrote:
>> Why do you want to integrate something to fontlock?
>
> To have it automatically updated when the buffer changes. I guess that's
> what the font-lock is for. No?
>
>> ,----
>> | X ==> point
>> |
>> | # One line starting with #.
>> |
>> | the line we want to add text properties to.
>> `----
>>
>> If you start to X (point) just running M-x test-prop will highlight
>> the line you want.
>>
>> Is it what you want to do?
>
> It's not all. The intend is to highlight buffer's first line which is
> not empty nor start with # character. Editing the buffer should update
> this automatically.
>
> So about your example, let's say that I later remove the leading comment
> character "# " from the third line. Now that changed line should
> automatically highlighted and the same highlighting removed from other
> lines. I assume such things can be done with font-locks?
Not sure.
However you can use hook to do that (think to add
(goto-char (point-min)) in test-prop):
(add-hook 'after-save-hook 'test-prop)
Each time you modify buffer and you hit C-x C-s, your line will be
highlighted.
Do the same for find-file.
To do that in real time, i don't know, except with a timer that check
you file all the n seconds.
--
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France
Re: Multi-line font-lock parser, Glenn Morris, 2009/08/17