From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: face-attribute and face-remapping-alist Date: Tue, 30 Mar 2021 22:05:00 +0300 Message-ID: <834kgsjwdf.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31996"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: "gliao.tw@pm.me" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Mar 30 21:06:46 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lRJhN-0008Da-Vz for ged-emacs-devel@m.gmane-mx.org; Tue, 30 Mar 2021 21:06:45 +0200 Original-Received: from localhost ([::1]:37852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lRJhM-0004Ua-UU for ged-emacs-devel@m.gmane-mx.org; Tue, 30 Mar 2021 15:06:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49402) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRJfX-0003tW-PU for emacs-devel@gnu.org; Tue, 30 Mar 2021 15:04:59 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:44493) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lRJfX-0008P1-De; Tue, 30 Mar 2021 15:04:51 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2197 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lRJfV-0002PA-Ps; Tue, 30 Mar 2021 15:04:51 -0400 In-Reply-To: (gliao.tw@pm.me) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:267192 Archived-At: > Date: Tue, 30 Mar 2021 18:53:28 +0000 > From: "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.