bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#44236: [PATCH] xdisp: Apply nobreak-char-display to all characters o


From: Neil Roberts
Subject: bug#44236: [PATCH] xdisp: Apply nobreak-char-display to all characters of blankp
Date: Wed, 28 Oct 2020 12:37:27 +0100

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.
+
 
 * 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 via email to

[Prev in Thread] Current Thread [Next in Thread]