[Top][All Lists]

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

Re: Question: add-face-text-property for 'font-lock-face?

From: Clément Pit-Claudel
Subject: Re: Question: add-face-text-property for 'font-lock-face?
Date: Sun, 29 Aug 2021 12:15:58 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

On 8/29/21 3:49 AM, Eli Zaretskii wrote:
>> From: Qiantan Hong <qhong@mit.edu>
>> CC: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
>> Date: Sun, 29 Aug 2021 07:19:03 +0000
>> I need to add some face attribute to a range of text.
>> And in case that font-lock-mode is active, the attribute needs to be
>> added to ‘font-lock-face instead of ‘face text property.
>>> I don't think I understand well enough what you want to do, but in
>>> general, you change a face's attribute by using set-face-attribute.
>> That doesn’t seem to work for anonymous faces.
>> I don’t want to globally modify other modes’ faces,
>> I want to add some attribute over some range of text.
>> add-face-text-property seems to exactly do this,
>> but it’s hardcoded for ‘face property in C code

> A face property is just a list of keyword-value pairs, so adding an
> attribute to the list should be trivial, no?  Or what am I missing?

You still need to iterate over regions of continuous text properties; it's not 
a complicated program, but it's not trivial either.

(Qiantan is hoping to preserve existing font-lock faces and append the CRDT.el 
face to them, AFAIU; so, it's a bit more work than appending to one list: you 
need to iterate over the region of interest, and append to each list of faces).

And if I understand correctly, then font-lock-append-text-property should fit 
the bill nicely.

reply via email to

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