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: Sat, 07 Dec 2024 11:50:45 +0200 Message-ID: <86ldwrkeiy.fsf@gnu.org> References: <86wmgfzhgc.fsf@gnu.org> <86zflay7hh.fsf@gnu.org> <86jzcey3cu.fsf@gnu.org> <8634j1n9nx.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13779"; mail-complaints-to="usenet@ciao.gmane.io" Cc: trevor.m.murphy@gmail.com, me@eshelyaron.com, 73862@debbugs.gnu.org To: aaronjensen@gmail.com, Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 07 10:51:28 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 1tJrTD-0003SX-Ju for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 07 Dec 2024 10:51:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tJrSp-0007MJ-Db; Sat, 07 Dec 2024 04:51:03 -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 1tJrSo-0007Lv-24 for bug-gnu-emacs@gnu.org; Sat, 07 Dec 2024 04:51:02 -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 1tJrSn-0000Ja-PL for bug-gnu-emacs@gnu.org; Sat, 07 Dec 2024 04:51:01 -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=ozGEzLmI+h9NpiTAIhvfP5GucyykVEZkAxUdXEyh/s0=; b=L22xL/19WU8zIqy8n0r2ncTIoXvwU5Y8Ug8IB3VyQQwUBxm47SBJ1kMQSMNHwOPhrRM+wBraOmAy9RDpZQVk2CvbRDbQGv9GcL5Dhap4qvbOAdL6r9ErbtL7afBZogdj5bLuaqQ52JV7GBJYyzb++7FkYXJbOhtqi9851cBbL3/vC8FJwnqLuHnjqWP/xqbQeufIm3GLTxTiE41bCeK41cjTDLFlyl7mLq2IasYJjlb5T4A1Aj2q6NujN9Xj7Hki4kdJACtVVGhNprJ18MXFPog6ADl3J8AC2yoms1A2BjacFP6X4fNcbCADSjDjh8GamP3YCO6IyfgED0SLiPNiEA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tJrSn-0002XB-JV for bug-gnu-emacs@gnu.org; Sat, 07 Dec 2024 04:51:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Dec 2024 09:51:01 +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.17335650579728 (code B ref 73862); Sat, 07 Dec 2024 09:51:01 +0000 Original-Received: (at 73862) by debbugs.gnu.org; 7 Dec 2024 09:50:57 +0000 Original-Received: from localhost ([127.0.0.1]:45425 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJrSi-0002Wp-Eh for submit@debbugs.gnu.org; Sat, 07 Dec 2024 04:50:56 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:42734) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJrSg-0002WZ-IO for 73862@debbugs.gnu.org; Sat, 07 Dec 2024 04:50:55 -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 1tJrSa-0000Ig-AI; Sat, 07 Dec 2024 04:50:48 -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=ozGEzLmI+h9NpiTAIhvfP5GucyykVEZkAxUdXEyh/s0=; b=EN6jGy6U9SJp hESMR7i1AAJr8L962Nq6lwzOqzXh7I3rjaEFvo1FcuN+bLVqd9tdA9RiyLpuiPs/Su/Tb5ZyTJPO4 3rBpCOFQ8kM1QyEtyrGDo0SSc7K83jb+jLID1htc1P3odLxM8s0OhgUAPwmCoba4fS5sfYXkJDjV2 XlPZFDb4WQe0GXtiVWHzjpfcEzG6Ea5bSCv7TzXOQ62RCScw5U+6b8BRmCDLVGrNE1sJaZpfg3AOY xV/zmrHlR918fjYqVnTW6ak322w32RbEaeBaTNzrB4hUrBXSejDjTbWdynPRAPT9KDUed5SFfXo9J rihzM/KyjRu737s8oK09/w==; In-Reply-To: <8634j1n9nx.fsf@gnu.org> (message from Eli Zaretskii on Thu, 05 Dec 2024 22:42:58 +0200) 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:296528 Archived-At: > 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 > > 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");