unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: aaronjensen@gmail.com, Stefan Monnier <monnier@iro.umontreal.ca>
Cc: trevor.m.murphy@gmail.com, me@eshelyaron.com, 73862@debbugs.gnu.org
Subject: bug#73862: [PATCH] Add `header-line-active` and `header-line-inactive` faces.
Date: Sat, 07 Dec 2024 11:50:45 +0200	[thread overview]
Message-ID: <86ldwrkeiy.fsf@gnu.org> (raw)
In-Reply-To: <8634j1n9nx.fsf@gnu.org> (message from Eli Zaretskii on Thu, 05 Dec 2024 22:42:58 +0200)

> Cc: trevor.m.murphy@gmail.com, me@eshelyaron.com, 73862@debbugs.gnu.org
> Date: Thu, 05 Dec 2024 22:42:58 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> 
> We could perhaps add special-purpose code that would consider face
> inheritance for mode-line and header-line faces when remapping them,
> but that would get is in a different mess:
> 
>  . mode-line-inactive inherits from mode-line only by default, on
>    color displays it doesn't; so if you remap mode-line,
>    mode-line-inactive will only be affected on monochrome displays
>  . header-line also inherits from mode-line, albeit only by default,
>    so remapping mode-line would _sometimes_ affect header-line (and
>    also header-line-active and header-line-inactive) and sometimes not
>  . if the user customizes some of the mode-line or header-line faces
>    to not inherit or to always inherit, remapping mode-line or
>    header-line will produce different results for different faces
> 
> So basically it's a royal mess, all of it caused by the fact that
> people somehow expect that remapping the header-line face will affect
> header-line-active and header-line-inactive, and similarly for
> mode-line.  That was never supported for basic faces, and I think it
> makes little sense to support it in the future, because the results
> will certainly surprise someone.
> 
> So I tend to close this bug as wontfix, and just mention in the
> documentation (NEWS at least) that people who remap header-line or
> mode-line need now to remap the new -active and -inactive faces.

If we do prefer to support remapping mode-line and header-line faces,
then I can suggest the semi-kludgey "fix" below.  Is this better than
what we have now?

Note that it immediately reveals the problems I mentioned above.  For
example, if you remap header-line, both header-line-active and
header-line-inactive immediately follow suit, but if you remap
mode-line, only mode-line-active follows, whereas mode-line-inactive
only follows on TTY frames (because all other frames support :box).
So if we install this, we should probably change the definition of
mode-line-inactive in some way?

Stefan, any suggestions or comments?

diff --git a/src/xfaces.c b/src/xfaces.c
index f626480..9704c05 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -5144,6 +5144,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))
+    {
+      /* Special treatment for mode-line and header-line faces, for
+	 backward compatibility: people might remap 'mode-line' and
+	 'header-line' faces and expect the *-active and *-inactive
+	 faces to change accordingly.  */
+      if (face_id == MODE_LINE_ACTIVE_FACE_ID
+	  || face_id == MODE_LINE_INACTIVE_FACE_ID)
+	mapping = assq_no_quit (Qmode_line, Vface_remapping_alist);
+      else if (face_id == HEADER_LINE_ACTIVE_FACE_ID
+	       || face_id == HEADER_LINE_INACTIVE_FACE_ID)
+	mapping = assq_no_quit (Qheader_line, Vface_remapping_alist);
+    }
+  if (NILP (mapping))
     return face_id;		/* Give up.  */
 
   /* If there is a remapping entry, lookup the face using NAME, which will
@@ -7447,6 +7460,7 @@ syms_of_xfaces (void)
   DEFSYM (Qcursor, "cursor");
   DEFSYM (Qborder, "border");
   DEFSYM (Qmouse, "mouse");
+  /* Qmode_line is defined in keyboard.c  */
   DEFSYM (Qmode_line_inactive, "mode-line-inactive");
   DEFSYM (Qmode_line_active, "mode-line-active");
   DEFSYM (Qvertical_border, "vertical-border");





  parent reply	other threads:[~2024-12-07  9:50 UTC|newest]

Thread overview: 41+ 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 [this message]
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-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

  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=86ldwrkeiy.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 \
    /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).