Subject: RE: [External] : bug#16177: 24.3.50; Display glyphs for hard spaces in color

From: Drew Adams <[email-masked]>
Date: Sun, 30 May 2021 15:00:32 +0000

> > To get hard spaces (aka nbsp) highlighted, you need to add `spaces' to
> > `whitespace-style': [...]  Narrow nbsp aren't highlighted.
> 
> I guess this is a feature request to have whitespace-mode being able to
> emphasise the space characters that aren't the normal ASCII space
> separately.  That (surprisingly enough) doesn't seem to be an option?
> And, indeed, whitespace-mode only knows about SPACE and NO-BREAK SPACE,
> and none of the other space characters.
> 
> So I think a new whitespace-style should be added -- like `other-space',
> for all the spaces that aren't SPACE.
> 
> However, the original impetus for doing this may be somewhat lessened by
> Emacs now defaulting to highlighting other spaces in a different way by
> default -- even without whitespace-mode.

The problem/question has been raised several times.

From bug #9790 (10 years ago):

  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=9790#21

  Various posts in this thread essentially propose different
  blanket approaches, i.e., paint something with a broad brush.
  Some want such brushwork in some contexts; others don't.

  What's needed, I think, are (1) a fine-grained mechanism to
  control which chars get highlighted and how and where/when,
  (2) default applications of that mechanism to specific contexts,
  and (3) user ability to control things.

  No broad brushwork will be satisfactory, I think.  I think
  some form of #1 is the starting point - without that, I
  don't see a good solution.

  I mentioned my library `highlight-chars.el', which provides
  support for #1: ways to highlight any set of chars, and
  control where/when/whether that's done.  Maybe take a look
  at what it offers, as food for thought or even perhaps reuse?

That bug, reported by Chong Yidong, follows from an
emacs-devel discussion of the problem/question.  And
that bug and similar/~duplicate ones are still open.

The overall approach/strategy should be discussed again,
perhaps, and a plan decided on wrt fixing the problem. 

See also:

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=14481#8

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=16177#8

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44236#11

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44236#75