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.bugs Subject: bug#73862: [PATCH] Add `header-line-active` and `header-line-inactive` faces. Date: Sun, 22 Dec 2024 17:52:25 +0200 Message-ID: <86r05z67gm.fsf@gnu.org> References: <86jzcey3cu.fsf@gnu.org> <8634j1n9nx.fsf@gnu.org> <86ldwrkeiy.fsf@gnu.org> <865xnviliv.fsf@gnu.org> <86wmgbgxjx.fsf@gnu.org> <86ttbfgvyr.fsf@gnu.org> <86r06jgv1j.fsf@gnu.org> <86jzcafcj6.fsf@gnu.org> <867c8af514.fsf@gnu.org> <86ldwpedud.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14306"; mail-complaints-to="usenet@ciao.gmane.io" Cc: trevor.m.murphy@gmail.com, yantar92@posteo.net, monnier@iro.umontreal.ca, 73862@debbugs.gnu.org To: Eshel Yaron , aaronjensen@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 22 16:54:12 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1tPOHT-0003Za-L9 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 22 Dec 2024 16:54:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tPOHO-0004Ht-Hj; Sun, 22 Dec 2024 10:54:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tPOHM-0004HD-17 for bug-gnu-emacs@gnu.org; Sun, 22 Dec 2024 10:54:04 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tPOHL-0007HA-Op for bug-gnu-emacs@gnu.org; Sun, 22 Dec 2024 10:54:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=VHt9XlipKvkRbNqpzUYaccLKFxLSMmuGuS4xpv+OjmE=; b=dnJ1FqSNIQTHHOSfS/RebNzCNvhuLf2ThBF73n17lareb4kK4gEDeOnmhKIwquLLJVKNbOo5rX/ebgOfIdQWdQZ5Z7rXq6uHUQ36p6SbSEt5vUHjHI4jEHIbbkufIVWuyhCOnfpddkxXBajni2kfKkiAsbdCkI7HzS9BQpSZppccWAr5KeJdDP0XpqMwToRnXgk9DXOMMSmW472lhGY7ukjWPNqz8GBH0YcmzvY7WgezEYroUQDyciauieid3FfHFtUjAmT2Zqy/43y1Y3ccFDQmCNLLCGlLlp42Gx4grwhxiXPcjOI4UKHapNTeka8T4AYcn/gzsiPTQaJ3K6mBbg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tPOHL-0003AB-Ed for bug-gnu-emacs@gnu.org; Sun, 22 Dec 2024 10:54:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 22 Dec 2024 15:54:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73862 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 73862-submit@debbugs.gnu.org id=B73862.173488278912065 (code B ref 73862); Sun, 22 Dec 2024 15:54:03 +0000 Original-Received: (at 73862) by debbugs.gnu.org; 22 Dec 2024 15:53:09 +0000 Original-Received: from localhost ([127.0.0.1]:51519 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPOGS-00038X-MG for submit@debbugs.gnu.org; Sun, 22 Dec 2024 10:53:09 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38996) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPOGO-00037y-Ml for 73862@debbugs.gnu.org; Sun, 22 Dec 2024 10:53:07 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tPOGI-0007DP-Sr; Sun, 22 Dec 2024 10:52:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=VHt9XlipKvkRbNqpzUYaccLKFxLSMmuGuS4xpv+OjmE=; b=GoA9gBJ7cfvq Pcq/VpKZ2e7C0/Iz86R8j5O1C7USrQYWaHQi47ZfAWK0dzwxl5x3IOkICWt3YLKpIf2lVgNPDuIRm Rd4c8t2dwpOpMHyBz9STfheBz0dpw0xh6IuFT8VMSaca/io9TiHjBP9cvqxUg3LW7M50mHg5hgmqL hxK/qrVYFw5BA0T17hNliDphCb/srKi0WwYnJJmUNZDint6626takQGlUUsNP6p45wqh3dblwyV8C swiOWB5Hz/eRafJ6w0brqKaFhAQHHnSuJifakeVFbuNhJ/oePUluZPkDC5TlXcVlqE/OTnMPjbafm D6ozijxv3/ET5kmzRLVehw==; In-Reply-To: (message from Eshel Yaron on Sat, 14 Dec 2024 10:45:45 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:297605 Archived-At: > From: Eshel Yaron > Cc: Eli Zaretskii , trevor.m.murphy@gmail.com, > monnier@iro.umontreal.ca, aaronjensen@gmail.com, 73862@debbugs.gnu.org, > Ihor Radchenko > Date: Sat, 14 Dec 2024 10:45:45 +0100 > > Eshel Yaron writes: > > >>> Aaron shared a recipe to reproduce this behavior, copied here: > >>> > >>> --8<---------------cut here---------------start------------->8--- > >>> (setq header-line-format "Some header") > >>> (face-remap-set-base 'header-line 'highlight) > >>> (switch-to-buffer-other-window "new") > >>> ;; In new buffer/window: > >>> (setq header-line-format "Some header") > >>> (other-window 1) > >>> ;; In original buffer/window: > >>> (set-face-attribute 'default nil :height (+ (face-attribute 'default :height) 10)) > >>> --8<---------------cut here---------------end--------------->8--- > >> > >> Are you also change the attributes of the default face to cause the > >> "spreading"? If not, please show a recipe. Because I was unable to > >> see this without something like the last line of the recipe, and also > >> that line _must_ be in the buffer where header-line is remapped, > >> otherwise the effect is not seen. > > > > Yes, I used C-x C-M-= in the buffer in which I remapped header-line. > > Note that this issue also affects Org: org-columns remaps header-line in > org-columns--display-here. (CC'ing Ihor.) Please try the patch below. If it gives good results, please run with it for awhile, and tell if you see anything unusual or unexpected. diff --git a/src/xfaces.c b/src/xfaces.c index 5f60f38..9591a5c 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -5143,10 +5143,19 @@ lookup_basic_face (struct window *w, struct frame *f, int face_id) for the very common no-remapping case. */ mapping = assq_no_quit (name, Vface_remapping_alist); if (NILP (mapping)) - return face_id; /* Give up. */ + { + Lisp_Object face_attrs[LFACE_VECTOR_SIZE]; + + /* If the face inherits from another, we need to realize it, + because the parent face could be remapped. */ + if (!get_lface_attributes (w, f, name, face_attrs, false, 0) + || NILP (face_attrs[LFACE_INHERIT_INDEX]) + || UNSPECIFIEDP (face_attrs[LFACE_INHERIT_INDEX])) + return face_id; /* Give up. */ + } - /* If there is a remapping entry, lookup the face using NAME, which will - handle the remapping too. */ + /* If there is a remapping entry, or the face inherits from another, + lookup the face using NAME, which will handle the remapping too. */ remapped_face_id = lookup_named_face (w, f, name, false); if (remapped_face_id < 0) return face_id; /* Give up. */ @@ -5863,6 +5872,11 @@ realize_basic_faces (struct frame *f) if (realize_default_face (f)) { + /* Basic faces must be realized disregarding face-remapping-alist, + since otherwise face-remapping might affect the basiic faces in + the face cache. */ + specpdl_ref count = SPECPDL_INDEX (); + specbind (Qface_remapping_alist, Qnil); realize_named_face (f, Qmode_line_active, MODE_LINE_ACTIVE_FACE_ID); realize_named_face (f, Qmode_line_inactive, MODE_LINE_INACTIVE_FACE_ID); realize_named_face (f, Qtool_bar, TOOL_BAR_FACE_ID); @@ -5884,6 +5898,7 @@ realize_basic_faces (struct frame *f) realize_named_face (f, Qchild_frame_border, CHILD_FRAME_BORDER_FACE_ID); realize_named_face (f, Qtab_bar, TAB_BAR_FACE_ID); realize_named_face (f, Qtab_line, TAB_LINE_FACE_ID); + unbind_to (count, Qnil); /* Reflect changes in the `menu' face in menu bars. */ if (FRAME_FACE_CACHE (f)->menu_face_changed_p)