diff options
| author | Paul Eggert | 2016-09-26 17:00:03 -0700 |
|---|---|---|
| committer | Paul Eggert | 2016-09-26 17:01:09 -0700 |
| commit | bbf1ffd7c74bdf3ea766580788f7f4adb98a47f0 (patch) | |
| tree | c53fbeacdf9c065397d20b3318a4876fb921b78b | |
| parent | 5b734087b18e4596cdf2fa34806e092c4b532db1 (diff) | |
| download | emacs-bbf1ffd7c74bdf3ea766580788f7f4adb98a47f0.tar.gz emacs-bbf1ffd7c74bdf3ea766580788f7f4adb98a47f0.zip | |
Regexp Functions doc minor fixes
* doc/lispref/searching.texi (Regexp Functions):
Fix misspelling of “matching”. Use @table for table.
Reformat code example to fit into info file width (Bug#17862).
| -rw-r--r-- | doc/lispref/searching.texi | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index a335e89985f..579460f3227 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi | |||
| @@ -950,37 +950,41 @@ more efficient, but is almost never worth the effort.}. | |||
| 950 | 950 | ||
| 951 | The optional argument @var{paren} can be any of the following: | 951 | The optional argument @var{paren} can be any of the following: |
| 952 | 952 | ||
| 953 | a string | 953 | @table @asis |
| 954 | the resulting regexp is preceded by @var{paren} and followed by | 954 | @item a string |
| 955 | @samp{\)}, e.g. use @samp{"\\(?1:"} to produce an explicitly | 955 | The resulting regexp is preceded by @var{paren} and followed by |
| 956 | numbered group. | 956 | @samp{\)}, e.g. use @samp{"\\(?1:"} to produce an explicitly |
| 957 | numbered group. | ||
| 957 | 958 | ||
| 958 | @code{words} | 959 | @item @code{words} |
| 959 | the resulting regexp is surrounded by @samp{\<\(} and @samp{\)\>}. | 960 | The resulting regexp is surrounded by @samp{\<\(} and @samp{\)\>}. |
| 960 | 961 | ||
| 961 | @code{symbols} | 962 | @item @code{symbols} |
| 962 | the resulting regexp is surrounded by @samp{\_<\(} and @samp{\)\_>} | 963 | The resulting regexp is surrounded by @samp{\_<\(} and @samp{\)\_>} |
| 963 | (this is often appropriate when maching programming-language | 964 | (this is often appropriate when matching programming-language |
| 964 | keywords and the like). | 965 | keywords and the like). |
| 965 | 966 | ||
| 966 | non-@code{nil} | 967 | @item non-@code{nil} |
| 967 | the resulting regexp is surrounded by @samp{\(} and @samp{\)}. | 968 | The resulting regexp is surrounded by @samp{\(} and @samp{\)}. |
| 968 | 969 | ||
| 969 | @code{nil} | 970 | @item @code{nil} |
| 970 | the resulting regexp is surrounded by @samp{\(?:} and @samp{\)}, | 971 | The resulting regexp is surrounded by @samp{\(?:} and @samp{\)}, |
| 971 | if it is necessary to ensure that a postfix operator appended to | 972 | if it is necessary to ensure that a postfix operator appended to |
| 972 | it will apply to the whole expression. | 973 | it will apply to the whole expression. |
| 974 | @end table | ||
| 973 | 975 | ||
| 974 | The resulting regexp of @code{regexp-opt} is equivalent to but usually | 976 | The resulting regexp of @code{regexp-opt} is equivalent to but usually |
| 975 | more efficient than that of a simplified version: | 977 | more efficient than that of a simplified version: |
| 976 | 978 | ||
| 977 | @example | 979 | @example |
| 978 | (defun simplified-regexp-opt (strings &optional paren) | 980 | (defun simplified-regexp-opt (strings &optional paren) |
| 979 | (let ((parens (cond ((stringp paren) (cons paren "\\)")) | 981 | (let ((parens |
| 980 | ((eq paren 'words) '("\\<\\(" . "\\)\\>")) | 982 | (cond |
| 981 | ((eq paren 'symbols) '("\\_<\\(" . "\\)\\_>")) | 983 | ((stringp paren) (cons paren "\\)")) |
| 982 | ((null paren) '("\\(?:" . "\\)")) | 984 | ((eq paren 'words) '("\\<\\(" . "\\)\\>")) |
| 983 | (t '("\\(" . "\\)"))))) | 985 | ((eq paren 'symbols) '("\\_<\\(" . "\\)\\_>")) |
| 986 | ((null paren) '("\\(?:" . "\\)")) | ||
| 987 | (t '("\\(" . "\\)"))))) | ||
| 984 | (concat (car paren) | 988 | (concat (car paren) |
| 985 | (mapconcat 'regexp-quote strings "\\|") | 989 | (mapconcat 'regexp-quote strings "\\|") |
| 986 | (cdr paren)))) | 990 | (cdr paren)))) |