diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2015-04-15 23:45:08 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2015-04-15 23:47:01 -0700 |
commit | 3074a9fad1c7c57948521125ee947bfa11ae185b (patch) | |
tree | 9f13c9d28a6e54ea12c7096f0d34652ffce15f6e /src/character.c | |
parent | 5161c9ca6a6107da30d411fb2ad72e01d08e5704 (diff) | |
download | emacs-3074a9fad1c7c57948521125ee947bfa11ae185b.tar.gz |
'[:graph:]' now excludes whitespace, not just ' '
* doc/lispref/searching.texi (Char Classes):
* lisp/emacs-lisp/rx.el (rx): Document [:graph:] to be [:print:]
sans whitespace (not sans space).
* src/character.c (graphicp): Exclude all Unicode whitespace chars,
not just space.
* src/regex.c (ISGRAPH): Exclude U+00A0 (NO-BREAK SPACE).
Diffstat (limited to 'src/character.c')
-rw-r--r-- | src/character.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/character.c b/src/character.c index ea98cf68e6c..c143c0f0e3e 100644 --- a/src/character.c +++ b/src/character.c @@ -984,8 +984,7 @@ character is not ASCII nor 8-bit character, an error is signaled. */) #ifdef emacs -/* Return 'true' if C is an alphabetic character as defined by its - Unicode properties. */ +/* Return true if C is an alphabetic character. */ bool alphabeticp (int c) { @@ -1008,8 +1007,7 @@ alphabeticp (int c) || gen_cat == UNICODE_CATEGORY_Nl); } -/* Return 'true' if C is an decimal-number character as defined by its - Unicode properties. */ +/* Return true if C is a decimal-number character. */ bool decimalnump (int c) { @@ -1022,16 +1020,25 @@ decimalnump (int c) return gen_cat == UNICODE_CATEGORY_Nd; } -/* Return 'true' if C is a graphic character as defined by its - Unicode properties. */ +/* Return true if C is a graphic character. */ bool graphicp (int c) { - return c == ' ' || printablep (c); + Lisp_Object category = CHAR_TABLE_REF (Vunicode_category_table, c); + if (! INTEGERP (category)) + return false; + EMACS_INT gen_cat = XINT (category); + + /* See UTS #18. */ + return (!(gen_cat == UNICODE_CATEGORY_Zs /* space separator */ + || gen_cat == UNICODE_CATEGORY_Zl /* line separator */ + || gen_cat == UNICODE_CATEGORY_Zp /* paragraph separator */ + || gen_cat == UNICODE_CATEGORY_Cc /* control */ + || gen_cat == UNICODE_CATEGORY_Cs /* surrogate */ + || gen_cat == UNICODE_CATEGORY_Cn)); /* unassigned */ } -/* Return 'true' if C is a printable character as defined by its - Unicode properties. */ +/* Return true if C is a printable character. */ bool printablep (int c) { |