all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Qiantan Hong <qhong@mit.edu>
Cc: emacs-devel@gnu.org
Subject: Re: Question: add-face-text-property for 'font-lock-face?
Date: Sun, 29 Aug 2021 10:49:15 +0300	[thread overview]
Message-ID: <835yvon11g.fsf@gnu.org> (raw)
In-Reply-To: <3272782D-2308-447C-B94B-A65E561C4D18@MIT.EDU> (message from Qiantan Hong on Sun, 29 Aug 2021 07:19:03 +0000)

> 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.



  reply	other threads:[~2021-08-29  7:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-29  4:13 Question: add-face-text-property for 'font-lock-face? Qiantan Hong
2021-08-29  4:24 ` Yuan Fu
     [not found]   ` <B73E855F-7E55-4217-BD43-E1272939E491@mit.edu>
2021-08-29  4:36     ` Qiantan Hong
2021-08-30  8:22       ` Ihor Radchenko
     [not found]     ` <945E4D23-3D8C-45AB-9C10-992638A30607@gmail.com>
2021-08-29  4:47       ` Qiantan Hong
2021-08-29 23:50         ` Stefan Monnier
2021-08-29  7:05 ` Eli Zaretskii
2021-08-29  7:19   ` Qiantan Hong
2021-08-29  7:49     ` Eli Zaretskii [this message]
2021-08-29 16:15       ` Clément Pit-Claudel
2021-08-29 21:13         ` Qiantan Hong
2021-08-29 23:47           ` Stefan Monnier
2021-08-30  0:41             ` Qiantan Hong
2021-08-30  8:18             ` Ihor Radchenko
2021-08-29 16:13 ` Clément Pit-Claudel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=835yvon11g.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=qhong@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.