From: Eli Zaretskii <eliz@gnu.org>
To: JD Smith <jdtsmith@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Local face remapping
Date: Thu, 05 Oct 2023 08:32:54 +0300 [thread overview]
Message-ID: <83y1gh4os9.fsf@gnu.org> (raw)
In-Reply-To: <5E16BC09-3063-4509-9DF6-7C8EC25E1285@gmail.com> (message from JD Smith on Wed, 4 Oct 2023 14:48:22 -0400)
> From: JD Smith <jdtsmith@gmail.com>
> Date: Wed, 4 Oct 2023 14:48:22 -0400
> Cc: emacs-devel@gnu.org
>
>
> > On Oct 4, 2023, at 12:54 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> >
> > Use different faces?
>
> Ha. Yes, of course you can can find and replace all the relevant faces in a region, but given that face-remapping-alist already does this efficiently for the entire buffer, I had hoped a similar region-constrained / overlay-based functionality might exist. I’ll take that as a no :).
Let me help you understand the situation better.
In Emacs, faces are defined per-frame. That is, each frame can have a
different definition of the same face symbol.
face-remapping-alist doesn't (and cannot) change that simple fact, so
it is a trick: it creates new faces based on default faces, in a way
that is buffer-local. This works (btw, not in all places) because the
display engine consults the buffer-local value of face-remapping-alist
each time it needs to realize a face for display. If that variable is
non-nil, and the face to be realized is mentioned in the alist, then
the display engine generates a new face on the fly and uses that new
face for display.
So, if you want face-remapping that depends on buffer positions, you
will need to change the implementation of face-remapping: instead of a
simple alist, we will probably need to also allow a function returning
such an alist, and the C code will need to be taught to deal with
the situation where face-remapping-alist's value is a function.
My suggestion to use different faces just does explicitly what
face-remapping-alist does implicitly.
next prev parent reply other threads:[~2023-10-05 5:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-04 12:58 Local face remapping JD Smith
2023-10-04 16:54 ` Eli Zaretskii
2023-10-04 18:48 ` JD Smith
2023-10-05 5:32 ` Eli Zaretskii [this message]
2023-10-05 13:12 ` JD Smith
2023-10-06 5:41 ` Eli Zaretskii
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=83y1gh4os9.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=jdtsmith@gmail.com \
/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.