diff options
| author | Eli Zaretskii | 2025-01-05 12:40:39 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2025-01-05 12:40:39 +0200 |
| commit | dc41ddb4d6bd7dc45cb9c37bc89c8c08f256baec (patch) | |
| tree | 4e88c82ae4b2a76216d87186b3934da1d22543a9 /src | |
| parent | 7eb8596ff5f1964f91664a6b7cac3199a5af5ba7 (diff) | |
| download | emacs-dc41ddb4d6bd7dc45cb9c37bc89c8c08f256baec.tar.gz emacs-dc41ddb4d6bd7dc45cb9c37bc89c8c08f256baec.zip | |
Allow to remap 'header-line' face
* src/xfaces.c (realize_basic_faces): Bind 'face-remapping-alist'
to nil while realizing basic faces.
(lookup_basic_face): Force realizing a face whose 'inherit'
attribute is non-nil. (Bug#73862)
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfaces.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/xfaces.c b/src/xfaces.c index 75fe73154ca..5c1300309dd 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -5146,10 +5146,19 @@ lookup_basic_face (struct window *w, struct frame *f, int face_id) | |||
| 5146 | for the very common no-remapping case. */ | 5146 | for the very common no-remapping case. */ |
| 5147 | mapping = assq_no_quit (name, Vface_remapping_alist); | 5147 | mapping = assq_no_quit (name, Vface_remapping_alist); |
| 5148 | if (NILP (mapping)) | 5148 | if (NILP (mapping)) |
| 5149 | return face_id; /* Give up. */ | 5149 | { |
| 5150 | Lisp_Object face_attrs[LFACE_VECTOR_SIZE]; | ||
| 5151 | |||
| 5152 | /* If the face inherits from another, we need to realize it, | ||
| 5153 | because the parent face could be remapped. */ | ||
| 5154 | if (!get_lface_attributes (w, f, name, face_attrs, false, 0) | ||
| 5155 | || NILP (face_attrs[LFACE_INHERIT_INDEX]) | ||
| 5156 | || UNSPECIFIEDP (face_attrs[LFACE_INHERIT_INDEX])) | ||
| 5157 | return face_id; /* Give up. */ | ||
| 5158 | } | ||
| 5150 | 5159 | ||
| 5151 | /* If there is a remapping entry, lookup the face using NAME, which will | 5160 | /* If there is a remapping entry, or the face inherits from another, |
| 5152 | handle the remapping too. */ | 5161 | lookup the face using NAME, which will handle the remapping too. */ |
| 5153 | remapped_face_id = lookup_named_face (w, f, name, false); | 5162 | remapped_face_id = lookup_named_face (w, f, name, false); |
| 5154 | if (remapped_face_id < 0) | 5163 | if (remapped_face_id < 0) |
| 5155 | return face_id; /* Give up. */ | 5164 | return face_id; /* Give up. */ |
| @@ -5866,6 +5875,12 @@ realize_basic_faces (struct frame *f) | |||
| 5866 | 5875 | ||
| 5867 | if (realize_default_face (f)) | 5876 | if (realize_default_face (f)) |
| 5868 | { | 5877 | { |
| 5878 | /* Basic faces must be realized disregarding face-remapping-alist, | ||
| 5879 | since otherwise face-remapping might affect the basic faces in the | ||
| 5880 | face cache, if this function happens to be invoked with current | ||
| 5881 | buffer set to a buffer with a non-nil face-remapping-alist. */ | ||
| 5882 | specpdl_ref count = SPECPDL_INDEX (); | ||
| 5883 | specbind (Qface_remapping_alist, Qnil); | ||
| 5869 | realize_named_face (f, Qmode_line_active, MODE_LINE_ACTIVE_FACE_ID); | 5884 | realize_named_face (f, Qmode_line_active, MODE_LINE_ACTIVE_FACE_ID); |
| 5870 | realize_named_face (f, Qmode_line_inactive, MODE_LINE_INACTIVE_FACE_ID); | 5885 | realize_named_face (f, Qmode_line_inactive, MODE_LINE_INACTIVE_FACE_ID); |
| 5871 | realize_named_face (f, Qtool_bar, TOOL_BAR_FACE_ID); | 5886 | realize_named_face (f, Qtool_bar, TOOL_BAR_FACE_ID); |
| @@ -5887,6 +5902,7 @@ realize_basic_faces (struct frame *f) | |||
| 5887 | realize_named_face (f, Qchild_frame_border, CHILD_FRAME_BORDER_FACE_ID); | 5902 | realize_named_face (f, Qchild_frame_border, CHILD_FRAME_BORDER_FACE_ID); |
| 5888 | realize_named_face (f, Qtab_bar, TAB_BAR_FACE_ID); | 5903 | realize_named_face (f, Qtab_bar, TAB_BAR_FACE_ID); |
| 5889 | realize_named_face (f, Qtab_line, TAB_LINE_FACE_ID); | 5904 | realize_named_face (f, Qtab_line, TAB_LINE_FACE_ID); |
| 5905 | unbind_to (count, Qnil); | ||
| 5890 | 5906 | ||
| 5891 | /* Reflect changes in the `menu' face in menu bars. */ | 5907 | /* Reflect changes in the `menu' face in menu bars. */ |
| 5892 | if (FRAME_FACE_CACHE (f)->menu_face_changed_p) | 5908 | if (FRAME_FACE_CACHE (f)->menu_face_changed_p) |