Fix the values and documentation of 'printable-chars' table
* src/character.c (syms_of_character) <printable-chars>: Doc fix. * lisp/international/characters.el (printable-chars): Fix values for non-ASCII characters. * doc/lispref/nonascii.texi (Character Properties): Add cross-reference for what is a printable character. * doc/lispref/display.texi (Usual Display): * doc/lispref/searching.texi (Char Classes): Add indexing. (Bug#76611)
This commit is contained in:
parent
18c8c44bef
commit
68a37760de
5 changed files with 26 additions and 3 deletions
|
@ -8585,6 +8585,7 @@ The newline character (character code 10) has a special effect: it
|
|||
ends the preceding line and starts a new line.
|
||||
|
||||
@cindex ASCII control characters
|
||||
@cindex non-printable ASCII characters
|
||||
@item
|
||||
The non-printable @dfn{@acronym{ASCII} control characters}---character
|
||||
codes 0 through 31, as well as the @key{DEL} character (character code
|
||||
|
|
|
@ -754,7 +754,10 @@ each character in columns that it will occupy on the screen.
|
|||
The value of this variable is a char-table that specifies, for each
|
||||
character, whether it is printable or not. That is, if evaluating
|
||||
@code{(aref printable-chars char)} results in @code{t}, the character
|
||||
is printable, and if it results in @code{nil}, it is not.
|
||||
is printable, and if it results in @code{nil}, it is not. The
|
||||
definition of what is a printable character is the same as for the
|
||||
@samp{[:print:]} character class in regular expressions, @pxref{Char
|
||||
Classes}.
|
||||
@end defvar
|
||||
|
||||
@node Character Sets
|
||||
|
|
|
@ -622,6 +622,7 @@ This matches any character whose code is in the range 0--31.
|
|||
@item [:digit:]
|
||||
This matches @samp{0} through @samp{9}. Thus, @samp{[-+[:digit:]]}
|
||||
matches any digit, as well as @samp{+} and @samp{-}.
|
||||
@cindex graphic characters
|
||||
@item [:graph:]
|
||||
This matches graphic characters---everything except spaces,
|
||||
@acronym{ASCII} and non-@acronym{ASCII} control characters,
|
||||
|
@ -638,6 +639,7 @@ one.
|
|||
This matches any multibyte character (@pxref{Text Representations}).
|
||||
@item [:nonascii:]
|
||||
This matches any non-@acronym{ASCII} character.
|
||||
@cindex printable characters
|
||||
@item [:print:]
|
||||
This matches any printing character---either spaces or graphic
|
||||
characters matched by @samp{[:graph:]}.
|
||||
|
|
|
@ -1608,6 +1608,22 @@ with L, LRE, or LRO Unicode bidi character type.")
|
|||
(lambda (range _ignore) (set-char-table-range char-width-table range 2))
|
||||
'arabic-2-column)
|
||||
|
||||
|
||||
;;; Setting printable-chars. The default is nil for control characters,
|
||||
;;; otherwise t.
|
||||
;;; The table is initialized in character.c with a crude approximation,
|
||||
;;; which considers any non-ASCII character above U+009F to be printable.
|
||||
;;; Note: this should be consistent with [:print:] character class,
|
||||
;;; see character.c:printablep.
|
||||
(let ((table (unicode-property-table-internal 'general-category)))
|
||||
(when table
|
||||
(map-char-table (lambda (key val)
|
||||
;; Cs: Surrogates
|
||||
;; Cn: Unassigned
|
||||
(when (memq val '(Cs Cn))
|
||||
(set-char-table-range printable-chars key nil)))
|
||||
table)))
|
||||
|
||||
;; Internal use only.
|
||||
;; Alist of locale symbol vs charsets. In a language environment
|
||||
;; corresponding to the locale, width of characters in the charsets is
|
||||
|
|
|
@ -1104,7 +1104,7 @@ symbol naming it. The ID of a translation table is an index into this vector.
|
|||
DEFVAR_LISP ("auto-fill-chars", Vauto_fill_chars,
|
||||
doc: /*
|
||||
A char-table for characters which invoke auto-filling.
|
||||
Such characters have value t in this table. */);
|
||||
Such characters have the value t in this table. */);
|
||||
Vauto_fill_chars = Fmake_char_table (Qauto_fill_chars, Qnil);
|
||||
CHAR_TABLE_SET (Vauto_fill_chars, ' ', Qt);
|
||||
CHAR_TABLE_SET (Vauto_fill_chars, '\n', Qt);
|
||||
|
@ -1126,7 +1126,8 @@ value of `cjk-ambiguous-chars-are-wide'. */);
|
|||
Vambiguous_width_chars = Fmake_char_table (Qnil, Qnil);
|
||||
|
||||
DEFVAR_LISP ("printable-chars", Vprintable_chars,
|
||||
doc: /* A char-table for each printable character. */);
|
||||
doc: /* A char-table for printable characters.
|
||||
Such characters have the value t in this table. */);
|
||||
Vprintable_chars = Fmake_char_table (Qnil, Qnil);
|
||||
Fset_char_table_range (Vprintable_chars,
|
||||
Fcons (make_fixnum (32), make_fixnum (126)), Qt);
|
||||
|
|
Loading…
Add table
Reference in a new issue