all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Multi-line font-lock parser
Date: Tue, 11 Aug 2009 09:55:39 +0200	[thread overview]
Message-ID: <87prb2eqdg.fsf@tux.homenetwork> (raw)
In-Reply-To: 87tz0e50wp.fsf@iki.fi

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





  reply	other threads:[~2009-08-11  7:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-10 19:19 Multi-line font-lock parser Teemu Likonen
2009-08-10 21:32 ` Thierry Volpiatto
     [not found] ` <mailman.4341.1249940353.2239.help-gnu-emacs@gnu.org>
2009-08-11  4:28   ` Teemu Likonen
2009-08-11  5:48     ` Thierry Volpiatto
     [not found]     ` <mailman.4364.1249970086.2239.help-gnu-emacs@gnu.org>
2009-08-11  6:18       ` Teemu Likonen
2009-08-11  7:55         ` Thierry Volpiatto [this message]
2009-08-18  1:29 ` Glenn Morris

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

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

  git send-email \
    --in-reply-to=87prb2eqdg.fsf@tux.homenetwork \
    --to=thierry.volpiatto@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.