diff options
| author | Mattias EngdegÄrd | 2019-12-13 13:10:58 +0100 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2019-12-13 13:30:14 +0100 |
| commit | 82b4e48c590cf2c0448a751e641b0ee7a6a02438 (patch) | |
| tree | 55da830604ce9ebe4a5aa626bec285fb688578a3 /doc | |
| parent | b04086adf649b18cf5309dd43aa638fc7b3cd4a0 (diff) | |
| download | emacs-82b4e48c590cf2c0448a751e641b0ee7a6a02438.tar.gz emacs-82b4e48c590cf2c0448a751e641b0ee7a6a02438.zip | |
Allow characters and single-char strings in rx charsets
The `not' and `intersection' forms, and `or' inside these forms,
now accept characters and single-character strings as arguments.
Previously, they had to be wrapped in `any' forms.
This does not add expressive power but is a convenience and is easily
understood.
* doc/lispref/searching.texi (Rx Constructs): Amend the documentation.
* etc/NEWS: Announce the change.
* lisp/emacs-lisp/rx.el (rx--charset-p, rx--translate-not)
(rx--charset-intervals, rx): Accept characters and 1-char strings in
more places.
* test/lisp/emacs-lisp/rx-tests.el (rx-not, rx-charset-or)
(rx-def-in-charset-or, rx-intersection): Test the change.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/searching.texi | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 0c6c7cc68b5..700880c2289 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi | |||
| @@ -1214,8 +1214,9 @@ Corresponding string regexp: @samp{[@dots{}]} | |||
| 1214 | @item @code{(not @var{charspec})} | 1214 | @item @code{(not @var{charspec})} |
| 1215 | @cindex @code{not} in rx | 1215 | @cindex @code{not} in rx |
| 1216 | Match a character not included in @var{charspec}. @var{charspec} can | 1216 | Match a character not included in @var{charspec}. @var{charspec} can |
| 1217 | be an @code{any}, @code{not}, @code{or}, @code{intersection}, | 1217 | be a character, a single-character string, an @code{any}, @code{not}, |
| 1218 | @code{syntax} or @code{category} form, or a character class. | 1218 | @code{or}, @code{intersection}, @code{syntax} or @code{category} form, |
| 1219 | or a character class. | ||
| 1219 | If @var{charspec} is an @code{or} form, its arguments have the same | 1220 | If @var{charspec} is an @code{or} form, its arguments have the same |
| 1220 | restrictions as those of @code{intersection}; see below.@* | 1221 | restrictions as those of @code{intersection}; see below.@* |
| 1221 | Corresponding string regexp: @samp{[^@dots{}]}, @samp{\S@var{code}}, | 1222 | Corresponding string regexp: @samp{[^@dots{}]}, @samp{\S@var{code}}, |
| @@ -1224,9 +1225,9 @@ Corresponding string regexp: @samp{[^@dots{}]}, @samp{\S@var{code}}, | |||
| 1224 | @item @code{(intersection @var{charset}@dots{})} | 1225 | @item @code{(intersection @var{charset}@dots{})} |
| 1225 | @cindex @code{intersection} in rx | 1226 | @cindex @code{intersection} in rx |
| 1226 | Match a character included in all of the @var{charset}s. | 1227 | Match a character included in all of the @var{charset}s. |
| 1227 | Each @var{charset} can be an @code{any} form without character | 1228 | Each @var{charset} can be a character, a single-character string, an |
| 1228 | classes, or an @code{intersection}, @code{or} or @code{not} form whose | 1229 | @code{any} form without character classes, or an @code{intersection}, |
| 1229 | arguments are also @var{charset}s. | 1230 | @code{or} or @code{not} form whose arguments are also @var{charset}s. |
| 1230 | 1231 | ||
| 1231 | @item @code{not-newline}, @code{nonl} | 1232 | @item @code{not-newline}, @code{nonl} |
| 1232 | @cindex @code{not-newline} in rx | 1233 | @cindex @code{not-newline} in rx |