From: Neil Roberts Date: Fri, 30 Oct 2020 12:13:31 +0000 (+0100) Subject: Use nobreak-space on all non-ASCII whitespace characters X-Git-Tag: emacs-28.0.90~5342 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f018cffca0098ad1b82c51730a6d6cf146e3c488;p=emacs.git Use nobreak-space on all non-ASCII whitespace characters * doc/emacs/display.texi (Text Display): Document it. * src/xdisp.c (get_next_display_element): Use blankp to test whether to use the nobreak_space face (bug#44236). --- diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index dd2c6e2cd86..02859d522e3 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -1608,7 +1608,8 @@ can cause problems if they are entered into a buffer without your 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 a/etc/NEWS b/etc/NEWS index 8504186208c..11783ef3192 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -163,6 +163,12 @@ your init file: (setq frame-title-format '(multiple-frames "%b" ("" invocation-name "@" system-name))) ++++ +** 'nobreak-char-display' now also affects all non-ASCII space characters. +Previously, this was limited only to NO-BREAK-SPACE and hyphen +characters. Now it also covers the rest of the non-ASCII Unicode +space characters. + * Editing Changes in Emacs 28.1 diff --git a/src/xdisp.c b/src/xdisp.c index 5c80e375810..0e5dffbe007 100644 --- a/src/xdisp.c +++ b/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) @@ -34747,7 +34747,8 @@ If the value is t, Emacs highlights non-ASCII chars which have the 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