GNU bug report logs - #13476
24.3.50; Reverting scroll-bar face customization has no effect

Previous Next

Package: emacs;

Reported by: Stephen Berman <stephen.berman <at> gmx.net>

Date: Thu, 17 Jan 2013 12:47:01 UTC

Severity: minor

Tags: fixed

Found in version 24.3.50

Fixed in version 28.1

Done: Mauro Aranda <maurooaranda <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13476 in the body.
You can then email your comments to 13476 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#13476; Package emacs. (Thu, 17 Jan 2013 12:47:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stephen Berman <stephen.berman <at> gmx.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 17 Jan 2013 12:47:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; Reverting scroll-bar face customization has no effect
Date: Thu, 17 Jan 2013 12:12:36 +0100
0. configure --without-toolkit-scroll-bars && make
1. emacs -Q
2. M-x customize-face RET scroll-bar RET, show all attributes, check the
   Foreground box , change its value to "green", and set for current
   session.
   Now the scroll bar is green.
3. Click the State button and select "Revert This Session's
   Customization".
=> The scroll bar is still green.
   Note that the Foreground box is unchecked.
4. Check the Foreground box.
   Note that its value is "black", though the scroll bar is green.

This pattern also obtains when starting Emacs without -Q, customizating
scroll-bar face, saving the change for future sessions, and then
reverting the customization.


In GNU Emacs 24.3.50.4 (x86_64-suse-linux-gnu, GTK+ Version 3.4.4)
 of 2013-01-17 on rosalinde
Bzr revision: 111542 michael.albinus <at> gmx.de-20130117090647-lb9mkbk6n8q142w5
Windowing system distributor `The X.Org Foundation', version 11.0.11203000
System Description:	openSUSE 12.2 (x86_64)

Configured using:
 `configure --without-toolkit-scroll-bars CFLAGS=-g3 -O0 --no-create
 --no-recursion'

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=local
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13476; Package emacs. (Fri, 30 Oct 2020 13:21:02 GMT) Full text and rfc822 format available.

Message #8 received at 13476 <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: 13476 <at> debbugs.gnu.org
Subject: Re: bug#13476: 24.3.50; Reverting scroll-bar face customization has
 no effect
Date: Fri, 30 Oct 2020 10:20:20 -0300
[Message part 1 (text/plain, inline)]
Stephen Berman <stephen.berman <at> gmx.net> writes:

> 0. configure --without-toolkit-scroll-bars && make
> 1. emacs -Q
> 2. M-x customize-face RET scroll-bar RET, show all attributes, check the
>    Foreground box , change its value to "green", and set for current
>    session.
>    Now the scroll bar is green.
> 3. Click the State button and select "Revert This Session's
>    Customization".
> => The scroll bar is still green.
>    Note that the Foreground box is unchecked.
> 4. Check the Foreground box.
>    Note that its value is "black", though the scroll bar is green.

I can reproduce this in latest master.

However, the problem seems not to be in Customize, but in faces.el.  Or
might be possible to fix it in faces.el, at least.

To revert to a previous face, Customize calls face-spec-set, which calls
face-spec-recalc for the face (in this case, the scroll-bar face).

For this face, this function sets all attributes to 'unspecified (via
face-spec-reset-face), and then tries to apply either a customized or
theme spec, or the face-default-spec.  But the scroll-bar face has this
definition:
(defface scroll-bar '((t nil))
  "Basic face for the scroll bar colors under X."
  :version "21.1"
  :group 'frames
  :group 'basic-faces)

So the default-attrs are nil for the scroll-bar face, resulting in
nothing else happening, which leaves the scroll-bar green.  Now, face
attributes say this:
(face-attribute 'scroll-bar :foreground nil nil) ==> nil
(face-attribute 'scroll-bar :foreground nil 'default) ==> "black"

BUT, we have this in the frame parameters:
(frame-parameter (selected-frame) 'scroll-bar-foreground) ==> "green"

The frame-parameter doesn't get updated, because we just unspecified the
:foreground attribute, we never specified something new, so this code in
internal-set-lisp-face-attribute:
if (!NILP (param))
{
 if (EQ (frame, Qt))
   /* Update `default-frame-alist', which is used for new frames.  */
   {
     store_in_alist (&Vdefault_frame_alist, param, value);
   }
 else
   /* Update the current frame's parameters.  */
   {
     AUTO_FRAME_ARG (arg, param, value);
     Fmodify_frame_parameters (frame, arg);
   }
}
doesn't run.

AFAICT, the reason the bug doesn't happen for other faces handled like
this, say the cursor face, is because the cursor face is defined like
this:
(defface cursor
  '((((background light)) :background "black")
    (((background dark))  :background "white"))
  "Basic face for the cursor color under X.
Currently, only the `:background' attribute is meaningful; all
other attributes are ignored.  The cursor foreground color is
taken from the background color of the underlying text.

Note: Other faces cannot inherit from the cursor face."
  :version "21.1"
  :group 'cursor
  :group 'basic-faces)

Meaning we do have non-nil default-attrs, and the
internal-set-lisp-face-attribute does run in this case, effectively
updating the frame parameter cursor-color.

The cursor face used to have the same definition as the scroll-bar face,
but it was changed to a "non-trivial" spec here:

commit 4983ddeaa82ea0d34b7dc9a6733f870da38b1c2e
Author: Chong Yidong <cyd <at> stupidchicken.com>
Date:   Wed Oct 13 23:55:18 2010 -0400

    Define a cursor defface; minor face optimizations.

    * faces.el (face-spec-reset-face): Reset all attributes in one
    single call to set-face-attribute.
    (face-spec-match-p): Make it a defsubst.
    (frame-set-background-mode): New arg KEEP-FACE-SPECS.
    (x-create-frame-with-faces, tty-create-frame-with-faces)
    (tty-set-up-initial-frame-faces): Don't recompute face specs in
    frame-set-background-mode, since they are recomputed immediately
    afterwards in face-set-after-frame-default.
    (face-set-after-frame-default): Minor optimization.
    (cursor): Provide non-trivial defface spec.

    * custom.el (custom-theme-recalc-face): Simplify.

So I'm thinking that perhaps an OK solution, at least for the scroll-bar
face, would be to give it a similar definition to that of the cursor
face.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13476; Package emacs. (Fri, 30 Oct 2020 13:31:01 GMT) Full text and rfc822 format available.

Message #11 received at 13476 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: 13476 <at> debbugs.gnu.org, stephen.berman <at> gmx.net
Subject: Re: bug#13476: 24.3.50;
 Reverting scroll-bar face customization has no effect
Date: Fri, 30 Oct 2020 15:30:10 +0200
> From: Mauro Aranda <maurooaranda <at> gmail.com>
> Date: Fri, 30 Oct 2020 10:20:20 -0300
> Cc: 13476 <at> debbugs.gnu.org
> 
> So I'm thinking that perhaps an OK solution, at least for the scroll-bar
> face, would be to give it a similar definition to that of the cursor
> face.

Yes, please try that.  If it fixes this minor problem, and doesn't
produce any unintended effects, it is IMO a fine solution for this
issue.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13476; Package emacs. (Fri, 30 Oct 2020 14:19:01 GMT) Full text and rfc822 format available.

Message #14 received at 13476 <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 13476 <at> debbugs.gnu.org, Stephen Berman <stephen.berman <at> gmx.net>
Subject: Re: bug#13476: 24.3.50; Reverting scroll-bar face customization has
 no effect
Date: Fri, 30 Oct 2020 11:18:01 -0300
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Mauro Aranda <maurooaranda <at> gmail.com>
>> Date: Fri, 30 Oct 2020 10:20:20 -0300
>> Cc: 13476 <at> debbugs.gnu.org
>>
>> So I'm thinking that perhaps an OK solution, at least for the scroll-bar
>> face, would be to give it a similar definition to that of the cursor
>> face.
>
> Yes, please try that.  If it fixes this minor problem, and doesn't
> produce any unintended effects, it is IMO a fine solution for this
> issue.

I've tried the attached patch.  Now reverting the foreground color
works, and I haven't seen unintended effects so far.
[Message part 2 (text/html, inline)]
[0001-Give-the-scroll-bar-face-a-non-trivial-spec.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13476; Package emacs. (Fri, 30 Oct 2020 21:47:02 GMT) Full text and rfc822 format available.

Message #17 received at 13476 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: 13476 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#13476: 24.3.50; Reverting scroll-bar face customization has
 no effect
Date: Fri, 30 Oct 2020 22:46:09 +0100
On Fri, 30 Oct 2020 11:18:01 -0300 Mauro Aranda <maurooaranda <at> gmail.com> wrote:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>>> From: Mauro Aranda <maurooaranda <at> gmail.com>
>>> Date: Fri, 30 Oct 2020 10:20:20 -0300
>>> Cc: 13476 <at> debbugs.gnu.org
>>>
>>> So I'm thinking that perhaps an OK solution, at least for the scroll-bar
>>> face, would be to give it a similar definition to that of the cursor
>>> face.
>>
>> Yes, please try that.  If it fixes this minor problem, and doesn't
>> produce any unintended effects, it is IMO a fine solution for this
>> issue.
>
> I've tried the attached patch.  Now reverting the foreground color
> works, and I haven't seen unintended effects so far.

I confirm it works for me too.

Steve Berman




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13476; Package emacs. (Sat, 31 Oct 2020 09:09:02 GMT) Full text and rfc822 format available.

Message #20 received at 13476 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: 13476 <at> debbugs.gnu.org, stephen.berman <at> gmx.net
Subject: Re: bug#13476: 24.3.50; Reverting scroll-bar face customization has
 no effect
Date: Sat, 31 Oct 2020 11:08:25 +0200
> From: Mauro Aranda <maurooaranda <at> gmail.com>
> Date: Fri, 30 Oct 2020 11:18:01 -0300
> Cc: Stephen Berman <stephen.berman <at> gmx.net>, 13476 <at> debbugs.gnu.org
> 
> I've tried the attached patch.  Now reverting the foreground color
> works, and I haven't seen unintended effects so far.

LGTM, thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13476; Package emacs. (Sat, 31 Oct 2020 20:16:02 GMT) Full text and rfc822 format available.

Message #23 received at 13476 <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 13476 <at> debbugs.gnu.org, Stephen Berman <stephen.berman <at> gmx.net>
Subject: Re: bug#13476: 24.3.50; Reverting scroll-bar face customization has
 no effect
Date: Sat, 31 Oct 2020 17:14:53 -0300
[Message part 1 (text/plain, inline)]
tags 13476 fixed
close 13476 28.1
quit

Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Mauro Aranda <maurooaranda <at> gmail.com>
>> Date: Fri, 30 Oct 2020 11:18:01 -0300
>> Cc: Stephen Berman <stephen.berman <at> gmx.net>, 13476 <at> debbugs.gnu.org
>>
>> I've tried the attached patch.  Now reverting the foreground color
>> works, and I haven't seen unintended effects so far.
>
> LGTM, thanks.

Pushed to master.  Closing.
[Message part 2 (text/html, inline)]

Added tag(s) fixed. Request was from Mauro Aranda <maurooaranda <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 31 Oct 2020 20:16:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 13476 <at> debbugs.gnu.org and Stephen Berman <stephen.berman <at> gmx.net> Request was from Mauro Aranda <maurooaranda <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 31 Oct 2020 20:16:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13476; Package emacs. (Sun, 01 Nov 2020 14:20:01 GMT) Full text and rfc822 format available.

Message #30 received at 13476 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 13476 <at> debbugs.gnu.org, stephen.berman <at> gmx.net,
 Mauro Aranda <maurooaranda <at> gmail.com>
Subject: Re: bug#13476: 24.3.50; Reverting scroll-bar face customization has
 no effect
Date: Sun, 01 Nov 2020 09:19:22 -0500
>> So I'm thinking that perhaps an OK solution, at least for the scroll-bar
>> face, would be to give it a similar definition to that of the cursor
>> face.
> Yes, please try that.  If it fixes this minor problem, and doesn't
> produce any unintended effects, it is IMO a fine solution for this
> issue.

Any chance we could drop support for the `scroll-bar-foreground`
frame parameter?  It seems this might be a path towards an actual
solution (rather than the current workaround)?


        Stefan





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 30 Nov 2020 12:24:10 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Po Lu <luangruo <at> yahoo.com> to control <at> debbugs.gnu.org. (Mon, 28 Feb 2022 02:30:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13476; Package emacs. (Mon, 28 Feb 2022 11:44:02 GMT) Full text and rfc822 format available.

Message #37 received at 13476 <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 13476 <at> debbugs.gnu.org, eliz <at> gnu.org, stephen.berman <at> gmx.net
Subject: Re: bug#13476: 24.3.50; Reverting scroll-bar face customization has
 no effect
Date: Mon, 28 Feb 2022 08:43:44 -0300
[Unarchive the bug before sending a message, so that the message reaches
the bug tracker]


Po Lu <luangruo <at> yahoo.com> writes:

> Mauro Aranda <maurooaranda <at> gmail.com> writes:
>
>> I've tried the attached patch.  Now reverting the foreground color
>> works, and I haven't seen unintended effects so far.
>
> I'm afraid that patch doesn't make sense, and causes bad side-effects
> with Athena and Motif scroll bars.
>
> With toolkit scroll bars, the foreground and background colors must be
> unspecified by default, so that the toolkit default is used instead.

Ok, sorry about that.

> So I think the bug lies in Custom (it should reset the value to
> "unspecified") and not the declaration of the scroll-bar face.

Why do you think it is a bug in Custom?

Custom relies on faces.el to update a customized face and to revert to
the default/standard.  So, with the old spec for scroll-bar:

(defface scroll-bar '((t nil))
  "Basic face for the scroll bar colors under X.")

;; Make sure the spec is set.
(face-spec-set 'scroll-bar '((t (:foreground "green"))) nil)
;; Reset to the standard.
(face-spec-set 'scroll-bar nil 'reset)

The scroll-bar foreground color stays green in the selected frame.

There's no Custom code involved there.

And face-spec-reset-face is setting all attributes to unspecified, I
thought that was clear from
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13476#8




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13476; Package emacs. (Mon, 28 Feb 2022 12:00:02 GMT) Full text and rfc822 format available.

Message #40 received at 13476 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: 13476 <at> debbugs.gnu.org, eliz <at> gnu.org, stephen.berman <at> gmx.net
Subject: Re: bug#13476: 24.3.50; Reverting scroll-bar face customization has
 no effect
Date: Mon, 28 Feb 2022 19:59:24 +0800
Mauro Aranda <maurooaranda <at> gmail.com> writes:

>> So I think the bug lies in Custom (it should reset the value to
>> "unspecified") and not the declaration of the scroll-bar face.
>
> Why do you think it is a bug in Custom?

I assumed it was, but it turned out to not be the case.  A better fix
was installed on master a few hours ago, please give it a try.  Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13476; Package emacs. (Mon, 28 Feb 2022 12:33:01 GMT) Full text and rfc822 format available.

Message #43 received at 13476 <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 13476 <at> debbugs.gnu.org, eliz <at> gnu.org, stephen.berman <at> gmx.net
Subject: Re: bug#13476: 24.3.50; Reverting scroll-bar face customization has
 no effect
Date: Mon, 28 Feb 2022 09:31:52 -0300
Po Lu <luangruo <at> yahoo.com> writes:

> Mauro Aranda <maurooaranda <at> gmail.com> writes:
>
>>> So I think the bug lies in Custom (it should reset the value to
>>> "unspecified") and not the declaration of the scroll-bar face.
>>
>> Why do you think it is a bug in Custom?
>
> I assumed it was, but it turned out to not be the case.  A better fix
> was installed on master a few hours ago, please give it a try.  Thanks.

It would have been nice to see the patch posted here.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13476; Package emacs. (Mon, 28 Feb 2022 12:52:01 GMT) Full text and rfc822 format available.

Message #46 received at 13476 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: 13476 <at> debbugs.gnu.org, eliz <at> gnu.org, stephen.berman <at> gmx.net
Subject: Re: bug#13476: 24.3.50; Reverting scroll-bar face customization has
 no effect
Date: Mon, 28 Feb 2022 20:51:05 +0800
Mauro Aranda <maurooaranda <at> gmail.com> writes:

> It would have been nice to see the patch posted here.

branch: master
commit 66899628f8a8c79ca8dfe32094f11a8320630fae
Author: Po Lu <luangruo <at> yahoo.com>
Commit: Po Lu <luangruo <at> yahoo.com>

    Better fix for bug#13476
    
    * lisp/faces.el (face-spec-recalc): Apply scroll bar foreground
    and background to the frame if changing the scroll-bar face.
    (scroll-bar): Restore previous declaration.  That way, the
    default colors are used for toolkit scroll bars, instead of
    black and white.
---
 lisp/faces.el | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/lisp/faces.el b/lisp/faces.el
index 76da210280..4b582ac439 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1743,7 +1743,14 @@ The following sources are applied in this order:
         (and tail (face-spec-set-2 face frame
                                    (list :extend (cadr tail))))))
     (setq face-attrs (face-spec-choose (get face 'face-override-spec) frame))
-    (face-spec-set-2 face frame face-attrs)))
+    (face-spec-set-2 face frame face-attrs)
+    (when (and (fboundp 'set-frame-parameter) ; This isn't available
+                                              ; during loadup.
+               (eq face 'scroll-bar))
+      ;; Set the `scroll-bar-foreground' and `scroll-bar-background'
+      ;; frame parameters.  (bug#13476)
+      (set-frame-parameter frame 'scroll-bar-foreground (face-foreground face))
+      (set-frame-parameter frame 'scroll-bar-background (face-background face)))))
 
 (defun face-spec-set-2 (face frame face-attrs)
   "Set the face attributes of FACE on FRAME according to FACE-ATTRS.
@@ -2826,11 +2833,9 @@ used to display the prompt text."
   :group 'frames
   :group 'basic-faces)
 
-(defface scroll-bar
-  '((((background light)) :foreground "black")
-    (((background dark))  :foreground "white"))
+(defface scroll-bar '((t nil))
   "Basic face for the scroll bar colors under X."
-  :version "28.1"
+  :version "21.1"
   :group 'frames
   :group 'basic-faces)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13476; Package emacs. (Mon, 28 Feb 2022 13:00:02 GMT) Full text and rfc822 format available.

Message #49 received at 13476 <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 13476 <at> debbugs.gnu.org, eliz <at> gnu.org, stephen.berman <at> gmx.net
Subject: Re: bug#13476: 24.3.50; Reverting scroll-bar face customization has
 no effect
Date: Mon, 28 Feb 2022 09:59:15 -0300
Po Lu <luangruo <at> yahoo.com> writes:

> Mauro Aranda <maurooaranda <at> gmail.com> writes:
>
>> It would have been nice to see the patch posted here.
>
> branch: master
> commit 66899628f8a8c79ca8dfe32094f11a8320630fae
> Author: Po Lu <luangruo <at> yahoo.com>
> Commit: Po Lu <luangruo <at> yahoo.com>
>
>     Better fix for bug#13476
>     
>     * lisp/faces.el (face-spec-recalc): Apply scroll bar foreground
>     and background to the frame if changing the scroll-bar face.
>     (scroll-bar): Restore previous declaration.  That way, the
>     default colors are used for toolkit scroll bars, instead of
>     black and white.
> ---
>  lisp/faces.el | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/lisp/faces.el b/lisp/faces.el
> index 76da210280..4b582ac439 100644
> --- a/lisp/faces.el
> +++ b/lisp/faces.el
> @@ -1743,7 +1743,14 @@ The following sources are applied in this order:
>          (and tail (face-spec-set-2 face frame
>                                     (list :extend (cadr tail))))))
>      (setq face-attrs (face-spec-choose (get face 'face-override-spec) frame))
> -    (face-spec-set-2 face frame face-attrs)))
> +    (face-spec-set-2 face frame face-attrs)
> +    (when (and (fboundp 'set-frame-parameter) ; This isn't available
> +                                              ; during loadup.
> +               (eq face 'scroll-bar))
> +      ;; Set the `scroll-bar-foreground' and `scroll-bar-background'
> +      ;; frame parameters.  (bug#13476)
> +      (set-frame-parameter frame 'scroll-bar-foreground (face-foreground face))
> +      (set-frame-parameter frame 'scroll-bar-background (face-background face)))))
>  
>  (defun face-spec-set-2 (face frame face-attrs)
>    "Set the face attributes of FACE on FRAME according to FACE-ATTRS.
> @@ -2826,11 +2833,9 @@ used to display the prompt text."
>    :group 'frames
>    :group 'basic-faces)
>  
> -(defface scroll-bar
> -  '((((background light)) :foreground "black")
> -    (((background dark))  :foreground "white"))
> +(defface scroll-bar '((t nil))
>    "Basic face for the scroll bar colors under X."
> -  :version "28.1"
> +  :version "21.1"
>    :group 'frames
>    :group 'basic-faces)

Thank you.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13476; Package emacs. (Mon, 28 Feb 2022 13:53:02 GMT) Full text and rfc822 format available.

Message #52 received at 13476 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: luangruo <at> yahoo.com, 13476 <at> debbugs.gnu.org, stephen.berman <at> gmx.net
Subject: Re: bug#13476: 24.3.50; Reverting scroll-bar face customization has
 no effect
Date: Mon, 28 Feb 2022 15:52:10 +0200
> From: Mauro Aranda <maurooaranda <at> gmail.com>
> Cc: eliz <at> gnu.org,  13476 <at> debbugs.gnu.org,  stephen.berman <at> gmx.net
> Date: Mon, 28 Feb 2022 09:59:15 -0300
> 
> > --- a/lisp/faces.el
> > +++ b/lisp/faces.el
> > @@ -1743,7 +1743,14 @@ The following sources are applied in this order:
> >          (and tail (face-spec-set-2 face frame
> >                                     (list :extend (cadr tail))))))
> >      (setq face-attrs (face-spec-choose (get face 'face-override-spec) frame))
> > -    (face-spec-set-2 face frame face-attrs)))
> > +    (face-spec-set-2 face frame face-attrs)
> > +    (when (and (fboundp 'set-frame-parameter) ; This isn't available
> > +                                              ; during loadup.
> > +               (eq face 'scroll-bar))
> > +      ;; Set the `scroll-bar-foreground' and `scroll-bar-background'
> > +      ;; frame parameters.  (bug#13476)
> > +      (set-frame-parameter frame 'scroll-bar-foreground (face-foreground face))
> > +      (set-frame-parameter frame 'scroll-bar-background (face-background face)))))

Why do we need this special treatment of the scroll-bar face?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13476; Package emacs. (Mon, 28 Feb 2022 14:05:02 GMT) Full text and rfc822 format available.

Message #55 received at 13476 <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: luangruo <at> yahoo.com, 13476 <at> debbugs.gnu.org, stephen.berman <at> gmx.net
Subject: Re: bug#13476: 24.3.50; Reverting scroll-bar face customization has
 no effect
Date: Mon, 28 Feb 2022 11:04:13 -0300
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Mauro Aranda <maurooaranda <at> gmail.com>
>> Cc: eliz <at> gnu.org,  13476 <at> debbugs.gnu.org,  stephen.berman <at> gmx.net
>> Date: Mon, 28 Feb 2022 09:59:15 -0300
>> 
>> > --- a/lisp/faces.el
>> > +++ b/lisp/faces.el
>> > @@ -1743,7 +1743,14 @@ The following sources are applied in this order:
>> >          (and tail (face-spec-set-2 face frame
>> >                                     (list :extend (cadr tail))))))
>> >      (setq face-attrs (face-spec-choose (get face 'face-override-spec) frame))
>> > -    (face-spec-set-2 face frame face-attrs)))
>> > +    (face-spec-set-2 face frame face-attrs)
>> > +    (when (and (fboundp 'set-frame-parameter) ; This isn't available
>> > +                                              ; during loadup.
>> > +               (eq face 'scroll-bar))
>> > +      ;; Set the `scroll-bar-foreground' and `scroll-bar-background'
>> > +      ;; frame parameters.  (bug#13476)
>> > +      (set-frame-parameter frame 'scroll-bar-foreground (face-foreground face))
>> > +      (set-frame-parameter frame 'scroll-bar-background (face-background face)))))
>
> Why do we need this special treatment of the scroll-bar face?

I haven't read the code yet so I can't really answer to your question.  What
I know is what I said on
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13476#8

Customizing and then resetting to the standard scroll-bar face failed
because the 'scroll-bar-foreground parameter wasn't updated after
resetting the attributes via face-spec-reset-face.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13476; Package emacs. (Mon, 28 Feb 2022 14:50:03 GMT) Full text and rfc822 format available.

Message #58 received at 13476 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: luangruo <at> yahoo.com, 13476 <at> debbugs.gnu.org, stephen.berman <at> gmx.net
Subject: Re: bug#13476: 24.3.50; Reverting scroll-bar face customization has
 no effect
Date: Mon, 28 Feb 2022 16:49:40 +0200
> From: Mauro Aranda <maurooaranda <at> gmail.com>
> Cc: luangruo <at> yahoo.com, 13476 <at> debbugs.gnu.org, stephen.berman <at> gmx.net
> Date: Mon, 28 Feb 2022 11:04:13 -0300
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >> From: Mauro Aranda <maurooaranda <at> gmail.com>
> >> Cc: eliz <at> gnu.org,  13476 <at> debbugs.gnu.org,  stephen.berman <at> gmx.net
> >> Date: Mon, 28 Feb 2022 09:59:15 -0300
> >> 
> >> > --- a/lisp/faces.el
> >> > +++ b/lisp/faces.el
> >> > @@ -1743,7 +1743,14 @@ The following sources are applied in this order:
> >> >          (and tail (face-spec-set-2 face frame
> >> >                                     (list :extend (cadr tail))))))
> >> >      (setq face-attrs (face-spec-choose (get face 'face-override-spec) frame))
> >> > -    (face-spec-set-2 face frame face-attrs)))
> >> > +    (face-spec-set-2 face frame face-attrs)
> >> > +    (when (and (fboundp 'set-frame-parameter) ; This isn't available
> >> > +                                              ; during loadup.
> >> > +               (eq face 'scroll-bar))
> >> > +      ;; Set the `scroll-bar-foreground' and `scroll-bar-background'
> >> > +      ;; frame parameters.  (bug#13476)
> >> > +      (set-frame-parameter frame 'scroll-bar-foreground (face-foreground face))
> >> > +      (set-frame-parameter frame 'scroll-bar-background (face-background face)))))
> >
> > Why do we need this special treatment of the scroll-bar face?
> 
> I haven't read the code yet so I can't really answer to your question.  What
> I know is what I said on
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13476#8
> 
> Customizing and then resetting to the standard scroll-bar face failed
> because the 'scroll-bar-foreground parameter wasn't updated after
> resetting the attributes via face-spec-reset-face.

I don't understand why we need to set the frame parameter when the
customize the face to begin with, I guess.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13476; Package emacs. (Mon, 28 Feb 2022 15:26:01 GMT) Full text and rfc822 format available.

Message #61 received at 13476 <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: luangruo <at> yahoo.com, 13476 <at> debbugs.gnu.org, stephen.berman <at> gmx.net
Subject: Re: bug#13476: 24.3.50; Reverting scroll-bar face customization has
 no effect
Date: Mon, 28 Feb 2022 12:25:06 -0300
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Mauro Aranda <maurooaranda <at> gmail.com>
>> Cc: luangruo <at> yahoo.com, 13476 <at> debbugs.gnu.org, stephen.berman <at> gmx.net
>> Date: Mon, 28 Feb 2022 11:04:13 -0300
>> 
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>> 
>> >> From: Mauro Aranda <maurooaranda <at> gmail.com>
>> >> Cc: eliz <at> gnu.org,  13476 <at> debbugs.gnu.org,  stephen.berman <at> gmx.net
>> >> Date: Mon, 28 Feb 2022 09:59:15 -0300
>> >> 
>> >> > --- a/lisp/faces.el
>> >> > +++ b/lisp/faces.el
>> >> > @@ -1743,7 +1743,14 @@ The following sources are applied in this order:
>> >> >          (and tail (face-spec-set-2 face frame
>> >> >                                     (list :extend (cadr tail))))))
>> >> >      (setq face-attrs (face-spec-choose (get face 'face-override-spec) frame))
>> >> > -    (face-spec-set-2 face frame face-attrs)))
>> >> > +    (face-spec-set-2 face frame face-attrs)
>> >> > +    (when (and (fboundp 'set-frame-parameter) ; This isn't available
>> >> > +                                              ; during loadup.
>> >> > +               (eq face 'scroll-bar))
>> >> > +      ;; Set the `scroll-bar-foreground' and `scroll-bar-background'
>> >> > +      ;; frame parameters.  (bug#13476)
>> >> > +      (set-frame-parameter frame 'scroll-bar-foreground (face-foreground face))
>> >> > +      (set-frame-parameter frame 'scroll-bar-background (face-background face)))))
>> >
>> > Why do we need this special treatment of the scroll-bar face?
>> 
>> I haven't read the code yet so I can't really answer to your question.  What
>> I know is what I said on
>> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13476#8
>> 
>> Customizing and then resetting to the standard scroll-bar face failed
>> because the 'scroll-bar-foreground parameter wasn't updated after
>> resetting the attributes via face-spec-reset-face.
>
> I don't understand why we need to set the frame parameter when the
> customize the face to begin with, I guess.

In an Emacs prior to c307c9648d541338814fe541389ea8c7a1cf50a5 and
configured with: --without-toolkit-scroll-bars

M-x customize-face RET scroll-bar
Customize the foreground color to "green", and set for current session.
Click the State button to "Revert This Session's Customization".
The scroll bar stays green, even when the foreground color says it is
black.

Evaluate the following:
(face-attribute 'scroll-bar :foreground nil 'default) ; ==> "black"
(frame-parameter (selected-frame) 'scroll-bar-foreground) ; ==> "green"

So, AFAIU the reason the scroll bar stayed green even after the attempt
to go back to the standard was that the frame parameter didn't change
after evaluating
(face-spec-reset 'scroll-bar nil 'reset)

Giving the scroll-bar face a non-trivial spec worked because it caused
some code in internal-set-lisp-face-attribute to update the
frame parameter, but it looks like it caused bad side effects when using
some toolkits.







Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13476; Package emacs. (Tue, 01 Mar 2022 00:31:01 GMT) Full text and rfc822 format available.

Message #64 received at 13476 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 13476 <at> debbugs.gnu.org, stephen.berman <at> gmx.net,
 Mauro Aranda <maurooaranda <at> gmail.com>
Subject: Re: bug#13476: 24.3.50; Reverting scroll-bar face customization has
 no effect
Date: Tue, 01 Mar 2022 08:30:15 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

> I don't understand why we need to set the frame parameter when the
> customize the face to begin with, I guess.

Because that's what you would expect to happen: customizing the
foreground or background of the scroll-bar face should affect the scroll
bar colors, which are frame parameters.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13476; Package emacs. (Tue, 01 Mar 2022 12:45:01 GMT) Full text and rfc822 format available.

Message #67 received at 13476 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 13476 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, maurooaranda <at> gmail.com
Subject: Re: bug#13476: 24.3.50; Reverting scroll-bar face customization has
 no effect
Date: Tue, 01 Mar 2022 14:44:12 +0200
> From: Po Lu <luangruo <at> yahoo.com>
> Cc: Mauro Aranda <maurooaranda <at> gmail.com>,  13476 <at> debbugs.gnu.org,
>   stephen.berman <at> gmx.net
> Date: Tue, 01 Mar 2022 08:30:15 +0800
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > I don't understand why we need to set the frame parameter when the
> > customize the face to begin with, I guess.
> 
> Because that's what you would expect to happen: customizing the
> foreground or background of the scroll-bar face should affect the scroll
> bar colors, which are frame parameters.

So this face is special in that we handle it via frame parameters?  In
that case, please add a comment to that effect where you made the
change.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13476; Package emacs. (Tue, 01 Mar 2022 12:49:01 GMT) Full text and rfc822 format available.

Message #70 received at 13476 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 13476 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, maurooaranda <at> gmail.com
Subject: Re: bug#13476: 24.3.50; Reverting scroll-bar face customization has
 no effect
Date: Tue, 01 Mar 2022 20:48:03 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

> So this face is special in that we handle it via frame parameters?  In
> that case, please add a comment to that effect where you made the
> change.

Thanks, will do.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 30 Mar 2022 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 25 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.