emacs-devel
[Top][All Lists]
Advanced

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

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


From: Qiantan Hong
Subject: Re: Question: add-face-text-property for 'font-lock-face?
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

textprop.c L1355:
>   AUTO_LIST2 (properties, Qface, face);
>   add_text_properties_1 (start, end, properties, object,
>                        (NILP (append)
>                         ? TEXT_PROPERTY_PREPEND
>                         : TEXT_PROPERTY_APPEND),
>                        false);
>   return Qnil;


It’s a trivial modification to support attributes other than face.
However it requires a patch to C code.
For now I think I’ll just workaround it by reinventing
the same functionality in Elisp.



reply via email to

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