unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "gliao.tw@pm.me" <gliao.tw@pm.me>
Cc: emacs-devel@gnu.org
Subject: Re: face-attribute and face-remapping-alist
Date: Tue, 30 Mar 2021 22:05:00 +0300	[thread overview]
Message-ID: <834kgsjwdf.fsf@gnu.org> (raw)
In-Reply-To: <EwbVM_pbf-MZVIrsnzMaJga8Jw9ZBHk4407RMezVzCzUSvML33SPOR7kEW1fTJU6MUvMW7saMCmRwGKAiNUEciI7sxWrtZoZdUwtzXEB60M=@pm.me> (gliao.tw@pm.me)

> Date: Tue, 30 Mar 2021 18:53:28 +0000
> From: "gliao.tw@pm.me" <gliao.tw@pm.me>
> 
> The `face-attribute' function defined in `faces.el' is the foundation of many face property inquiry functions such as `face-background'. However, `face-attribute' is not aware of buffer-local variable 'face-remapping-alist' which is used for buffer-specific theming.
> 
> Since there are many modes, such as `term-mode', rely on `face-attribute' to obtain face information while `face-attribute' is only capabale of obtaining frame-specific, rather than buffer-specific face infomation, these modes cannot display faces sufficiently well while a buffer-local theme is applied via `face-remap-add-relative' or `face-remap-set-base' (both functions, defined in `face-remap.el', add items to buffer-specific variable `face-remapping-alist').
> 
> Therefore, I propose the following prototype of an enhanced version of `face-attribute' function that is aware of the existence of `face-remapping-alist' in current buffer and return face property from `face-remapping-alist' instead of  frame-specific (single frame also means global) face property.

Thanks, but unconditionally changing the behavior of face-attribute in
such fundamental ways is a non-starter.  There must be a way to still
get the frame-specific face attributes, un-effected by buffer-specific
remapping.  face-attribute is quite a low-level API, and face
remapping is a higher-level feature.

So if we want face-attribute to pay attention to face remapping, that
must be an optional behavior under control of some optional argument
or a variable that could be let-bound.

Alternatively, we could introduce a new API for what you want.



  reply	other threads:[~2021-03-30 19:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30 18:53 face-attribute and face-remapping-alist gliao.tw
2021-03-30 19:05 ` Eli Zaretskii [this message]
2021-03-30 19:13   ` Eli Zaretskii
2021-03-31  3:05     ` gliao.tw
2021-03-31  3:34       ` gliao.tw
2021-03-31  6:58       ` Eli Zaretskii
2021-03-31 13:00         ` Clément Pit-Claudel
2021-03-31 13:27           ` Eli Zaretskii
2021-03-31 22:41         ` gliao.tw
2021-04-01  7:08           ` 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=834kgsjwdf.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=gliao.tw@pm.me \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).