[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question: add-face-text-property for 'font-lock-face?
From: |
Eli Zaretskii |
Subject: |
Re: Question: add-face-text-property for 'font-lock-face? |
Date: |
Sun, 29 Aug 2021 10:49:15 +0300 |
> 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?
> 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.
Adding something to a list is so simple you don't need to invent
anything, I think.
Re: Question: add-face-text-property for 'font-lock-face?, Eli Zaretskii, 2021/08/29
- Re: Question: add-face-text-property for 'font-lock-face?, Qiantan Hong, 2021/08/29
- Re: Question: add-face-text-property for 'font-lock-face?,
Eli Zaretskii <=
- Re: Question: add-face-text-property for 'font-lock-face?, Clément Pit-Claudel, 2021/08/29
- Re: Question: add-face-text-property for 'font-lock-face?, Qiantan Hong, 2021/08/29
- Re: Question: add-face-text-property for 'font-lock-face?, Stefan Monnier, 2021/08/29
- Re: Question: add-face-text-property for 'font-lock-face?, Qiantan Hong, 2021/08/29
- Re: Question: add-face-text-property for 'font-lock-face?, Ihor Radchenko, 2021/08/30
Re: Question: add-face-text-property for 'font-lock-face?, Clément Pit-Claudel, 2021/08/29