diff options
| author | Eli Zaretskii | 2022-08-27 11:56:00 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2022-08-27 11:56:00 +0300 |
| commit | 56aa52c346d5317a9f228ca12d52d4c860c458b0 (patch) | |
| tree | 486d6b0080ee5956b05d5803c669ad4ef0baa5e2 /src | |
| parent | 4015d561c39d29200bf1ac542844fd5f3ba99426 (diff) | |
| download | emacs-56aa52c346d5317a9f228ca12d52d4c860c458b0.tar.gz emacs-56aa52c346d5317a9f228ca12d52d4c860c458b0.zip | |
Support "replacement characters" on TTY frames
* src/nsterm.m (ns_draw_glyphless_glyph_string_foreground):
* src/pgtkterm.c (pgtk_draw_glyphless_glyph_string_foreground):
* src/haikuterm.c (haiku_draw_glyphless_glyph_string_foreground):
* src/xterm.c (x_draw_glyphless_glyph_string_foreground):
* src/w32term.c (w32_draw_glyphless_glyph_string_foreground):
* src/xdisp.c (lookup_glyphless_char_display): Handle extra-slot
of 'glyphless-char-display' that is a cons cell.
(syms_of_xdisp) <glyphless-char-display>: Update doc string.
* etc/NEWS:
* doc/lispref/display.texi (Glyphless Chars): Document the new
feature.
* lisp/faces.el (glyphless-char): Make the face stand out on TTY
frames that don't support the underline attribute.
Diffstat (limited to 'src')
| -rw-r--r-- | src/haikuterm.c | 2 | ||||
| -rw-r--r-- | src/nsterm.m | 2 | ||||
| -rw-r--r-- | src/pgtkterm.c | 2 | ||||
| -rw-r--r-- | src/term.c | 22 | ||||
| -rw-r--r-- | src/w32term.c | 2 | ||||
| -rw-r--r-- | src/xdisp.c | 17 | ||||
| -rw-r--r-- | src/xterm.c | 2 |
7 files changed, 36 insertions, 13 deletions
diff --git a/src/haikuterm.c b/src/haikuterm.c index c2d4e34ba25..df1c39974f8 100644 --- a/src/haikuterm.c +++ b/src/haikuterm.c | |||
| @@ -1252,6 +1252,8 @@ haiku_draw_glyphless_glyph_string_foreground (struct glyph_string *s) | |||
| 1252 | ? CHAR_TABLE_REF (Vglyphless_char_display, | 1252 | ? CHAR_TABLE_REF (Vglyphless_char_display, |
| 1253 | glyph->u.glyphless.ch) | 1253 | glyph->u.glyphless.ch) |
| 1254 | : XCHAR_TABLE (Vglyphless_char_display)->extras[0]); | 1254 | : XCHAR_TABLE (Vglyphless_char_display)->extras[0]); |
| 1255 | if (CONSP (acronym)) | ||
| 1256 | acronym = XCAR (acronym); | ||
| 1255 | if (STRINGP (acronym)) | 1257 | if (STRINGP (acronym)) |
| 1256 | str = SSDATA (acronym); | 1258 | str = SSDATA (acronym); |
| 1257 | } | 1259 | } |
diff --git a/src/nsterm.m b/src/nsterm.m index e3f47eb905e..6c6151701b8 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -4241,6 +4241,8 @@ ns_draw_glyphless_glyph_string_foreground (struct glyph_string *s) | |||
| 4241 | ? CHAR_TABLE_REF (Vglyphless_char_display, | 4241 | ? CHAR_TABLE_REF (Vglyphless_char_display, |
| 4242 | glyph->u.glyphless.ch) | 4242 | glyph->u.glyphless.ch) |
| 4243 | : XCHAR_TABLE (Vglyphless_char_display)->extras[0]); | 4243 | : XCHAR_TABLE (Vglyphless_char_display)->extras[0]); |
| 4244 | if (CONSP (acronym)) | ||
| 4245 | acronym = XCAR (acronym); | ||
| 4244 | if (STRINGP (acronym)) | 4246 | if (STRINGP (acronym)) |
| 4245 | str = SSDATA (acronym); | 4247 | str = SSDATA (acronym); |
| 4246 | } | 4248 | } |
diff --git a/src/pgtkterm.c b/src/pgtkterm.c index b283cef7cde..491ba338821 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c | |||
| @@ -1584,6 +1584,8 @@ pgtk_draw_glyphless_glyph_string_foreground (struct glyph_string *s) | |||
| 1584 | ? CHAR_TABLE_REF (Vglyphless_char_display, | 1584 | ? CHAR_TABLE_REF (Vglyphless_char_display, |
| 1585 | glyph->u.glyphless.ch) | 1585 | glyph->u.glyphless.ch) |
| 1586 | : XCHAR_TABLE (Vglyphless_char_display)->extras[0]); | 1586 | : XCHAR_TABLE (Vglyphless_char_display)->extras[0]); |
| 1587 | if (CONSP (acronym)) | ||
| 1588 | acronym = XCAR (acronym); | ||
| 1587 | if (STRINGP (acronym)) | 1589 | if (STRINGP (acronym)) |
| 1588 | str = SSDATA (acronym); | 1590 | str = SSDATA (acronym); |
| 1589 | } | 1591 | } |
diff --git a/src/term.c b/src/term.c index 3bea621dbda..2e43d89232f 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -1862,12 +1862,24 @@ produce_glyphless_glyph (struct it *it, Lisp_Object acronym) | |||
| 1862 | acronym = CHAR_TABLE_REF (Vglyphless_char_display, it->c); | 1862 | acronym = CHAR_TABLE_REF (Vglyphless_char_display, it->c); |
| 1863 | if (CONSP (acronym)) | 1863 | if (CONSP (acronym)) |
| 1864 | acronym = XCDR (acronym); | 1864 | acronym = XCDR (acronym); |
| 1865 | buf[0] = '['; | ||
| 1866 | str = STRINGP (acronym) ? SSDATA (acronym) : ""; | 1865 | str = STRINGP (acronym) ? SSDATA (acronym) : ""; |
| 1867 | for (len = 0; len < 6 && str[len] && ASCII_CHAR_P (str[len]); len++) | 1866 | /* A special kludgey feature for single-character acronyms: |
| 1868 | buf[1 + len] = str[len]; | 1867 | don't put them in a box, effectively treating them as a |
| 1869 | buf[1 + len] = ']'; | 1868 | replacement character. */ |
| 1870 | len += 2; | 1869 | if (STRINGP (acronym) && SCHARS (acronym) == 1) |
| 1870 | { | ||
| 1871 | buf[0] = str[0]; | ||
| 1872 | len = 1; | ||
| 1873 | } | ||
| 1874 | else | ||
| 1875 | { | ||
| 1876 | buf[0] = '['; | ||
| 1877 | for (len = 0; | ||
| 1878 | len < 6 && str[len] && ASCII_CHAR_P (str[len]); len++) | ||
| 1879 | buf[1 + len] = str[len]; | ||
| 1880 | buf[1 + len] = ']'; | ||
| 1881 | len += 2; | ||
| 1882 | } | ||
| 1871 | } | 1883 | } |
| 1872 | else | 1884 | else |
| 1873 | { | 1885 | { |
diff --git a/src/w32term.c b/src/w32term.c index d0577efccc1..dff21489e5b 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -1490,6 +1490,8 @@ w32_draw_glyphless_glyph_string_foreground (struct glyph_string *s) | |||
| 1490 | ? CHAR_TABLE_REF (Vglyphless_char_display, | 1490 | ? CHAR_TABLE_REF (Vglyphless_char_display, |
| 1491 | glyph->u.glyphless.ch) | 1491 | glyph->u.glyphless.ch) |
| 1492 | : XCHAR_TABLE (Vglyphless_char_display)->extras[0]); | 1492 | : XCHAR_TABLE (Vglyphless_char_display)->extras[0]); |
| 1493 | if (CONSP (acronym)) | ||
| 1494 | acronym = XCAR (acronym); | ||
| 1493 | if (STRINGP (acronym)) | 1495 | if (STRINGP (acronym)) |
| 1494 | str = SSDATA (acronym); | 1496 | str = SSDATA (acronym); |
| 1495 | } | 1497 | } |
diff --git a/src/xdisp.c b/src/xdisp.c index 86a119c0f63..70f6936dd0b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -7842,15 +7842,14 @@ lookup_glyphless_char_display (int c, struct it *it) | |||
| 7842 | && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display)) >= 1) | 7842 | && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display)) >= 1) |
| 7843 | { | 7843 | { |
| 7844 | if (c >= 0) | 7844 | if (c >= 0) |
| 7845 | { | 7845 | glyphless_method = CHAR_TABLE_REF (Vglyphless_char_display, c); |
| 7846 | glyphless_method = CHAR_TABLE_REF (Vglyphless_char_display, c); | ||
| 7847 | if (CONSP (glyphless_method)) | ||
| 7848 | glyphless_method = FRAME_WINDOW_P (it->f) | ||
| 7849 | ? XCAR (glyphless_method) | ||
| 7850 | : XCDR (glyphless_method); | ||
| 7851 | } | ||
| 7852 | else | 7846 | else |
| 7853 | glyphless_method = XCHAR_TABLE (Vglyphless_char_display)->extras[0]; | 7847 | glyphless_method = XCHAR_TABLE (Vglyphless_char_display)->extras[0]; |
| 7848 | |||
| 7849 | if (CONSP (glyphless_method)) | ||
| 7850 | glyphless_method = FRAME_WINDOW_P (it->f) | ||
| 7851 | ? XCAR (glyphless_method) | ||
| 7852 | : XCDR (glyphless_method); | ||
| 7854 | } | 7853 | } |
| 7855 | 7854 | ||
| 7856 | retry: | 7855 | retry: |
| @@ -37117,7 +37116,9 @@ GRAPHICAL and TEXT should each have one of the values listed above. | |||
| 37117 | The char-table has one extra slot to control the display of a character for | 37116 | The char-table has one extra slot to control the display of a character for |
| 37118 | which no font is found. This slot only takes effect on graphical terminals. | 37117 | which no font is found. This slot only takes effect on graphical terminals. |
| 37119 | Its value should be an ASCII acronym string, `hex-code', `empty-box', or | 37118 | Its value should be an ASCII acronym string, `hex-code', `empty-box', or |
| 37120 | `thin-space'. The default is `empty-box'. | 37119 | `thin-space'. It could also be a cons cell of any two of these, to specify |
| 37120 | separate values for graphical and text terminals. | ||
| 37121 | The default is `empty-box'. | ||
| 37121 | 37122 | ||
| 37122 | If a character has a non-nil entry in an active display table, the | 37123 | If a character has a non-nil entry in an active display table, the |
| 37123 | display table takes effect; in this case, Emacs does not consult | 37124 | display table takes effect; in this case, Emacs does not consult |
diff --git a/src/xterm.c b/src/xterm.c index c716d07adaf..e7f55255021 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -8316,6 +8316,8 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) | |||
| 8316 | ? CHAR_TABLE_REF (Vglyphless_char_display, | 8316 | ? CHAR_TABLE_REF (Vglyphless_char_display, |
| 8317 | glyph->u.glyphless.ch) | 8317 | glyph->u.glyphless.ch) |
| 8318 | : XCHAR_TABLE (Vglyphless_char_display)->extras[0]); | 8318 | : XCHAR_TABLE (Vglyphless_char_display)->extras[0]); |
| 8319 | if (CONSP (acronym)) | ||
| 8320 | acronym = XCAR (acronym); | ||
| 8319 | if (STRINGP (acronym)) | 8321 | if (STRINGP (acronym)) |
| 8320 | str = SSDATA (acronym); | 8322 | str = SSDATA (acronym); |
| 8321 | } | 8323 | } |