[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to prevent font-lock from messing with a portion of text?
From: |
Stefan Monnier |
Subject: |
Re: how to prevent font-lock from messing with a portion of text? |
Date: |
Fri, 23 Mar 2007 18:36:14 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.96 (gnu/linux) |
>> > Use put-text-property to add a face to some text using the
>> > `face' property.
>> > Prevent subsequent "erasure" of that highlighting by font-lock.
>>
>> The `font-lock-face' property was designed specifically for this
>> kind of case.
> 1. That's only for Emacs 22.
Yup.
> 2. It doesn't prevent font-lock from clobbering the highlighted text when
> doing syntactic font lock (e.g. in comments).
It's true that font-lock's own faces take precedence. But the
font-lock-face property is not clobbered.
> 3. The highlighting is removed when font-lock-mode is turned off.
Again, the lont-lock-face properties are not removed. But yes, it is made
inactive.
> 4. It won't help with other code (e.g. 3rd library) that happens to use the
> `face' property.
Yup.
> IOW, no, `font-lock-face' property was not at all designed specifically for
> this
> kind of case. Highlight some text, and have it stay highlighted whether or
> not font-lock-mode is on. Have font-lock ignore that text when it does its
> own highlighting.
Well, with those extra conditions, then indeed, no it doesn't quite fit
your bill.
How 'bout:
- use font-lock-mode-hook to move `face' properties to/from a new property
`persistent-face' when turning font-lock-mode on/off.
- add a font-lock-fontify-region-function so that after fontifying
the region normally, you scan the region for `persistent-face' properties
and copy those to the `face' property.
> That's too bad. How about adding that, after the release?
I'm not interested in coding it up because I don't see a need for it, but if
someone provides a clean patch, I don't see any reason why I'd oppose it.
> From what you say, it sounds as if that whole passage about that property
> should be stated in terms of jit-lock only. And there should be a cross
> reference to the place where jit-lock is introduced.
Yes, that's probably right.
Stefan
- how to prevent font-lock from messing with a portion of text?, Drew Adams, 2007/03/22
- Re: how to prevent font-lock from messing with a portion of text?, Stefan Monnier, 2007/03/22
- Re: how to prevent font-lock from messing with a portion of text?, Miles Bader, 2007/03/22
- Re: how to prevent font-lock from messing with a portion of text?, Stefan Monnier, 2007/03/23
- RE: how to prevent font-lock from messing with a portion of text?, Drew Adams, 2007/03/23
- Re: how to prevent font-lock from messing with a portion of text?, Lennart Borgman (gmail), 2007/03/23
- Re: how to prevent font-lock from messing with a portion of text?,
Stefan Monnier <=
- RE: how to prevent font-lock from messing with a portion of text?, Drew Adams, 2007/03/23
- Re: how to prevent font-lock from messing with a portion of text?, Lennart Borgman (gmail), 2007/03/23
- Re: how to prevent font-lock from messing with a portion of text?, Stefan Monnier, 2007/03/24
- Re: how to prevent font-lock from messing with a portion of text?, Lennart Borgman (gmail), 2007/03/24
- Re: how to prevent font-lock from messing with a portion of text?, Stefan Monnier, 2007/03/24
- Re: how to prevent font-lock from messing with a portion of text?, Lennart Borgman (gmail), 2007/03/24
- Re: how to prevent font-lock from messing with a portion of text?, Stefan Monnier, 2007/03/24
- RE: how to prevent font-lock from messing with a portion of text?, Drew Adams, 2007/03/25
- Re: how to prevent font-lock from messing with a portion of text?, Lennart Borgman (gmail), 2007/03/25
- RE: how to prevent font-lock from messing with a portion of text?, Drew Adams, 2007/03/26