diff options
| author | Noam Postavsky | 2018-05-24 19:49:11 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2018-05-25 07:54:30 -0400 |
| commit | 2f44d2d5b15008fde44a56ca24f0c3b6b9e63faf (patch) | |
| tree | 2ae3b57329f2340ba68e5aac92f50f9d464716f4 | |
| parent | 3145d08cae4a203e86af1920a72eb1b8d0f40d73 (diff) | |
| download | emacs-2f44d2d5b15008fde44a56ca24f0c3b6b9e63faf.tar.gz emacs-2f44d2d5b15008fde44a56ca24f0c3b6b9e63faf.zip | |
Note caveat for backward regexp searching in docstring (Bug#31584)
* src/search.c (Fre_search_backward): Emphasize that backwards
searches may give shorter than expected matches.
* doc/lispref/searching.texi (Regexp Search): Add an anchor for
re-search-backward to reference.
| -rw-r--r-- | doc/lispref/searching.texi | 2 | ||||
| -rw-r--r-- | src/search.c | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index fca877117d9..6c1ebb22b53 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi | |||
| @@ -1102,6 +1102,8 @@ comes back" twice. | |||
| 1102 | @end example | 1102 | @end example |
| 1103 | @end deffn | 1103 | @end deffn |
| 1104 | 1104 | ||
| 1105 | @c This anchor is referenced by re-search-backward's docstring. | ||
| 1106 | @anchor{re-search-backward} | ||
| 1105 | @deffn Command re-search-backward regexp &optional limit noerror count | 1107 | @deffn Command re-search-backward regexp &optional limit noerror count |
| 1106 | This function searches backward in the current buffer for a string of | 1108 | This function searches backward in the current buffer for a string of |
| 1107 | text that is matched by the regular expression @var{regexp}, leaving | 1109 | text that is matched by the regular expression @var{regexp}, leaving |
diff --git a/src/search.c b/src/search.c index 842e9309a2e..6d010466dcd 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -2233,8 +2233,11 @@ DEFUN ("re-search-backward", Fre_search_backward, Sre_search_backward, 1, 4, | |||
| 2233 | This function is almost identical to `re-search-forward', except that | 2233 | This function is almost identical to `re-search-forward', except that |
| 2234 | by default it searches backward instead of forward, and the sign of | 2234 | by default it searches backward instead of forward, and the sign of |
| 2235 | COUNT also indicates exactly the opposite searching direction. | 2235 | COUNT also indicates exactly the opposite searching direction. |
| 2236 | See `re-search-forward' for details. | ||
| 2236 | 2237 | ||
| 2237 | See `re-search-forward' for details. */) | 2238 | Note that searching backwards may give a shorter match than expected, |
| 2239 | because REGEXP is still matched in the forward direction. See Info | ||
| 2240 | anchor `(elisp) re-search-backward' for details. */) | ||
| 2238 | (Lisp_Object regexp, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count) | 2241 | (Lisp_Object regexp, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count) |
| 2239 | { | 2242 | { |
| 2240 | return search_command (regexp, bound, noerror, count, -1, 1, 0); | 2243 | return search_command (regexp, bound, noerror, count, -1, 1, 0); |