all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Eshel Yaron <me@eshelyaron.com>, aaronjensen@gmail.com
Cc: trevor.m.murphy@gmail.com, yantar92@posteo.net,
	monnier@iro.umontreal.ca, 73862@debbugs.gnu.org
Subject: bug#73862: [PATCH] Add `header-line-active` and `header-line-inactive` faces.
Date: Sun, 22 Dec 2024 17:52:25 +0200	[thread overview]
Message-ID: <86r05z67gm.fsf@gnu.org> (raw)
In-Reply-To: <m1h676a986.fsf@macbookpro.home> (message from Eshel Yaron on Sat, 14 Dec 2024 10:45:45 +0100)

> From: Eshel Yaron <me@eshelyaron.com>
> Cc: Eli Zaretskii <eliz@gnu.org>,  trevor.m.murphy@gmail.com,
>   monnier@iro.umontreal.ca,  aaronjensen@gmail.com,  73862@debbugs.gnu.org,
>  Ihor Radchenko <yantar92@posteo.net>
> 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)





  reply	other threads:[~2024-12-22 15:52 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-18 12:56 bug#73862: [PATCH] Add `header-line-active` and `header-line-inactive` faces trevor.m.murphy
2024-10-27 10:46 ` Eli Zaretskii
2024-11-09  9:37   ` Eli Zaretskii
2024-11-11  6:11     ` Trevor Murphy
2024-11-16 14:11       ` Eli Zaretskii
2024-12-04  5:06 ` Aaron Jensen
2024-12-04  6:30   ` Aaron Jensen
2024-12-04 13:49     ` Eli Zaretskii
2024-12-05  3:06       ` Aaron Jensen
2024-12-05  6:22         ` Eli Zaretskii
2024-12-05  6:50           ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-05  7:31             ` Eli Zaretskii
2024-12-05  6:53           ` Aaron Jensen
2024-12-05  7:29             ` Aaron Jensen
2024-12-05  7:51               ` Eli Zaretskii
2024-12-05 16:02                 ` Aaron Jensen
2024-12-05 20:42                   ` Eli Zaretskii
2024-12-05 21:14                     ` Aaron Jensen
2024-12-06  8:55                       ` Eli Zaretskii
2024-12-06 14:53                         ` Aaron Jensen
2024-12-06 16:28                           ` Aaron Jensen
2024-12-07  9:54                             ` Eli Zaretskii
2024-12-07  9:50                     ` Eli Zaretskii
2024-12-07 13:28                       ` Aaron Jensen
2024-12-07 15:02                         ` Eli Zaretskii
2024-12-07 17:13                           ` Aaron Jensen
2024-12-07 18:25                             ` Eli Zaretskii
2024-12-07 18:46                               ` Aaron Jensen
2024-12-07 18:59                                 ` Eli Zaretskii
2024-12-07 19:06                                   ` Aaron Jensen
2024-12-07 19:19                                     ` Eli Zaretskii
2024-12-07 19:59                                       ` Aaron Jensen
2024-12-08 14:11                                       ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-08 14:57                                         ` Eli Zaretskii
2024-12-08 16:29                                           ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-08 17:26                                             ` Aaron Jensen
2024-12-08 17:39                                             ` Eli Zaretskii
2024-12-08 20:56                                               ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-09  3:26                                                 ` Eli Zaretskii
2024-12-09  8:56                                                   ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-14  9:45                                                     ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-22 15:52                                                       ` Eli Zaretskii [this message]
2024-12-05  7:35             ` 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=86r05z67gm.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=73862@debbugs.gnu.org \
    --cc=aaronjensen@gmail.com \
    --cc=me@eshelyaron.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=trevor.m.murphy@gmail.com \
    --cc=yantar92@posteo.net \
    /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.