[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: set-text-properties and jit-lock-mode
From: |
Alan Schmitt |
Subject: |
Re: set-text-properties and jit-lock-mode |
Date: |
Mon, 22 Feb 2016 08:29:15 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) |
On 2016-02-21 20:04, Alan Mackenzie <address@hidden> writes:
>> The problem: if jit-lock-mode it t, then using set-text-properties to
>> change the face does not work.
>
>> To reproduce: start emacs with -Q. In the scratch buffer, type "foo".
>> Then evaluate:
>> (set-text-properties 192 195 (list 'face 'italic))
>
>> Nothing changes, and when I do a `describe-char' on one letter of "foo"
>> I don't see the face.
>
> At a guess, what's happening here is this: your `set-text-properties'
> does indeed work. But setting text properties is a buffer change. So
> `before-change-functions' and `after-change-functions' will both be
> executed. `a-c-f' contains `jit-lock-after-change', which helpfully
> refontifies the line for you. All this happens before the screen is
> redisplayed.
>
> If you bind these hooks to nil around your call, I think it will work:
>
> (let (before-change-functions after-change-functions)
> (set-text-properties 192 195 (list 'face 'italic)))
Thanks a lot for the suggestion, but unfortunately it does not work. I
guess some other function must be re-fontifying the text.
Alan
--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂ (2016-01, Mauna Loa Obs.): 402.52
signature.asc
Description: PGP signature