Subject: bug#35797: 26.2; Adaptive Wrap does not respect Whitespace Mode faces

From: Eli Zaretskii <[email-masked]>
Date: Wed, 22 May 2019 09:04:03 +0300

> From: Stephen Berman <[email-masked]>
> Date: Sun, 19 May 2019 23:50:59 +0200
> Cc: [email-masked]
> 
> On Sat, 18 May 2019 20:18:54 -0700 Andrew T <[email-masked]> wrote:
> 
> > Appears to be similar to bug #15155: "24.3; wrap-prefix in adaptive-
> > wrap-prefix-mode with variable-pitch has wrong face"
> 
> That bug was fixed, but the fix does not prevent your problem, so it
> seems to be a different issue.

Yes, I think it's a different issue.

> >   emacs -Q
> >   M-x package-install RET adaptive-wrap RET
> >   M-x adaptive-wrap-prefix-mode RET
> >   M-x whitespace-mode RET
> >
> > ...Then write a long indented line so that it will wrap, and see see
> > how the wrap prefix is a different color from the default whitespace
> > display characters.
> >
> > I'll also include some screenshots here:
> > <https://imgur.com/a/znbU0s3>
> 
> Whitespace mode displays dots where there are spaces by altering the
> buffer's display table.  This also affects the spaces added by
> adaptive-wrap-prefix-mode, but as you have seen, those spaces are not
> affected by customizing whitespace-mode faces.  I suspect this has to do
> with how wrap-prefix is implemented in the display engine and may not be
> easy to fix.

I don't think there's anything special about wrap-prefix
implementation: it just acts as if a display string was specified at
the proper buffer location.

I think the problem here is entirely different: both the
whitespace-space face used for the space characters and the
whitespace-line face used for the wrapped line specify background
colors.  When we merge these faces, the background of one of them must
win.  You can see that if you avoid specifying the background color
for the whitespace-line face, the whitespace in the wrap-prefix has
the expected face.

So I don't think there's a problem here.  Emacs behaves as expected.