unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Neil Roberts via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 44236@debbugs.gnu.org
Subject: bug#44236: [PATCH] xdisp: Apply nobreak-char-display to all characters of blankp
Date: Wed, 28 Oct 2020 12:37:27 +0100	[thread overview]
Message-ID: <20201028113727.107967-1-bpeeluk@yahoo.co.uk> (raw)
In-Reply-To: <83imavelpg.fsf@gnu.org>

nobreak-char-display is documented as making Emacs display all
non-ASCII chars that have the same appearance as an ASCII space using
a special face. In practice however, this was limited to nbsp and the
hyphen characters. When using a monospace font, there are many other
characters that resemble an ASCII space, such as U+202F NARROW
NO-BREAK SPACE. That is like the normal non-breaking space character
except that it is slightly narrower. In the French language, this
character is supposed to be used before most punctuation marks such as
question marks and quote characters, so it is quite prevalent. For
that reason it would be nice if it was displayed differently like the
regular non-breaking space.

This patch makes it show all non-ASCII characters from the Unicode
horizontal space class using the special face.

* src/xdisp.c (get_next_display_element): Use blankp to test whether
to use the nobreak_space face.
---
 doc/emacs/display.texi | 3 ++-
 etc/NEWS               | 8 ++++++++
 src/xdisp.c            | 5 +++--
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git doc/emacs/display.texi doc/emacs/display.texi
index 6f1bc802b8..ccc945c3af 100644
--- doc/emacs/display.texi
+++ doc/emacs/display.texi
@@ -1605,7 +1605,8 @@ Text Display
 realization, e.g., by yanking; for instance, source code compilers
 typically do not treat non-@acronym{ASCII} spaces as whitespace
 characters.  To deal with this problem, Emacs displays such characters
-specially: it displays @code{U+00A0} (no-break space) with the
+specially: it displays @code{U+00A0} (no-break space) and other
+characters from the Unicode horizontal space class with the
 @code{nobreak-space} face, and it displays @code{U+00AD} (soft
 hyphen), @code{U+2010} (hyphen), and @code{U+2011} (non-breaking
 hyphen) with the @code{nobreak-hyphen} face.  To disable this, change
diff --git etc/NEWS etc/NEWS
index 7dbd3d51fa..dcf9a75723 100644
--- etc/NEWS
+++ etc/NEWS
@@ -163,6 +163,14 @@ your init file:
     (setq frame-title-format '(multiple-frames "%b"
                               ("" invocation-name "@" system-name)))
 
++++
+** 'nobreak-char-display' now also affects all non-ASCII Unicode horizontal space characters.
+The documented intention of this variable is to cause Emacs to display
+characters that could be confused with a space character using a
+different face. Previously this was limited only to NBSP and hyphen
+characters. Now it covers all of the Unicode space characters,
+including narrow NBSP, which has the same appearance.
+
 \f
 * Editing Changes in Emacs 28.1
 
diff --git src/xdisp.c src/xdisp.c
index 5a62cd6eb5..cf30ba9479 100644
--- src/xdisp.c
+++ src/xdisp.c
@@ -7555,7 +7555,7 @@ get_next_display_element (struct it *it)
 	     non-ASCII spaces and hyphens specially.  */
 	  if (! ASCII_CHAR_P (c) && ! NILP (Vnobreak_char_display))
 	    {
-	      if (c == NO_BREAK_SPACE)
+	      if (blankp (c))
 		nonascii_space_p = true;
 	      else if (c == SOFT_HYPHEN || c == HYPHEN
 		       || c == NON_BREAKING_HYPHEN)
@@ -34740,7 +34740,8 @@ syms_of_xdisp (void)
 same appearance as an ASCII space or hyphen, using the `nobreak-space'
 or `nobreak-hyphen' face respectively.
 
-U+00A0 (no-break space), U+00AD (soft hyphen), U+2010 (hyphen), and
+All of the non-ASCII characters in the Unicode horizontal whitespace
+character class, as well as U+00AD (soft hyphen), U+2010 (hyphen), and
 U+2011 (non-breaking hyphen) are affected.
 
 Any other non-nil value means to display these characters as an escape
-- 
2.25.4






  reply	other threads:[~2020-10-28 11:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20201026111348.773761-1-bpeeluk.ref@yahoo.co.uk>
2020-10-26 11:13 ` bug#44236: [PATCH] xdisp: Apply nobreak-char-display also to NARROW NO-BREAK SPACE U+202F Neil Roberts via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-10-26 16:29   ` Eli Zaretskii
2020-10-26 16:55     ` Drew Adams
2020-10-27  9:17     ` Neil Roberts via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-10-27 15:24       ` Eli Zaretskii
2020-10-28 11:37         ` Neil Roberts via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2020-10-30 12:14           ` bug#44236: (no subject) Lars Ingebrigtsen
2020-11-01  8:20     ` bug#44236: [PATCH] xdisp: Apply nobreak-char-display also to NARROW NO-BREAK SPACE U+202F Juri Linkov
2020-11-01  8:30       ` Juri Linkov
2020-11-01 13:12       ` Lars Ingebrigtsen
2020-11-01 15:16         ` Eli Zaretskii
2020-11-01 18:51           ` Juri Linkov
2020-11-01 19:29             ` Eli Zaretskii
2020-11-01 19:40               ` Juri Linkov
2020-11-01 19:52                 ` Eli Zaretskii
2020-11-01 20:12                   ` Juri Linkov
2020-11-03 18:44                     ` Juri Linkov
2020-11-03 21:07                       ` Basil L. Contovounesios
2020-11-04 19:54                         ` Juri Linkov
2020-11-01 18:53         ` Juri Linkov
2020-11-01 19:30           ` Eli Zaretskii
2020-11-01 19:41             ` Juri Linkov
2020-11-01 19:59               ` Eli Zaretskii
2020-11-01 19:41           ` Neil Roberts via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-11-01 20:00             ` Juri Linkov

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=20201028113727.107967-1-bpeeluk@yahoo.co.uk \
    --to=bug-gnu-emacs@gnu.org \
    --cc=44236@debbugs.gnu.org \
    --cc=bpeeluk@yahoo.co.uk \
    /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).