summaryrefslogtreecommitdiff
path: root/src/xdisp.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2021-10-05 17:12:49 +0300
committerEli Zaretskii <eliz@gnu.org>2021-10-05 17:12:49 +0300
commitb5afbedc908e97cc5094a336cc275390d618e82e (patch)
tree9ebd63d6b2c57f3bf495f8a63b30e53fbfd9d0c0 /src/xdisp.c
parentea1b728a06ebbe61910c9f8f5de2fdf2c07f9178 (diff)
downloademacs-b5afbedc908e97cc5094a336cc275390d618e82e.tar.gz
emacs-b5afbedc908e97cc5094a336cc275390d618e82e.tar.bz2
emacs-b5afbedc908e97cc5094a336cc275390d618e82e.zip
Backward compatibility option for 'nobreak-char-display'
* src/xdisp.c (syms_of_xdisp) <nobreak-char-ascii-display>: New variable. (get_next_display_element): If 'nobreak-char-ascii-display' is non-nil, display non-ASCII space and hyphen characters as their ASCII equivalents. (Bug#50983) * etc/NEWS: * etc/PROBLEMS: Mention 'nobreak-char-ascii-display'.
Diffstat (limited to 'src/xdisp.c')
-rw-r--r--src/xdisp.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index b777d1b2825..9ddf0dd54b5 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -7668,7 +7668,8 @@ get_next_display_element (struct it *it)
/* Merge `nobreak-space' into the current face. */
face_id = merge_faces (it->w, Qnobreak_space, 0,
it->face_id);
- XSETINT (it->ctl_chars[0], it->c);
+ XSETINT (it->ctl_chars[0],
+ nobreak_char_ascii_display ? ' ' : it->c);
ctl_len = 1;
goto display_control;
}
@@ -7681,7 +7682,8 @@ get_next_display_element (struct it *it)
/* Merge `nobreak-space' into the current face. */
face_id = merge_faces (it->w, Qnobreak_hyphen, 0,
it->face_id);
- XSETINT (it->ctl_chars[0], it->c);
+ XSETINT (it->ctl_chars[0],
+ nobreak_char_ascii_display ? '-' : it->c);
ctl_len = 1;
goto display_control;
}
@@ -35034,6 +35036,26 @@ glyph followed by an ordinary space or hyphen.
A value of nil means no special handling of these characters. */);
Vnobreak_char_display = Qt;
+ DEFVAR_BOOL ("nobreak-char-ascii-display", nobreak_char_ascii_display,
+ doc: /* Control display of non-ASCII space and hyphen chars.
+If the value of this variable is nil, the default, Emacs displays
+non-ASCII chars which have the same appearance as an ASCII space
+or hyphen as themselves, with the `nobreak-space' or `nobreak-hyphen'
+face, respectively.
+
+If the value is t, these characters are displayed as their ASCII
+counterparts: whitespace characters as ASCII space, hyphen characters
+as ASCII hyphen (a.k.a. \"dash\"), using the `nobreak-space' or
+the `nobreak-hyphen' face.
+
+This variable has effect only if `nobreak-char-display' is t;
+otherwise it is ignored.
+
+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. */);
+ nobreak_char_ascii_display = false;
+
DEFVAR_LISP ("void-text-area-pointer", Vvoid_text_area_pointer,
doc: /* The pointer shape to show in void text areas.
A value of nil means to show the text pointer. Other options are