]> git.eshelyaron.com Git - emacs.git/commitdiff
Note caveat for backward regexp searching in docstring (Bug#31584)
authorNoam Postavsky <npostavs@gmail.com>
Thu, 24 May 2018 23:49:11 +0000 (19:49 -0400)
committerNoam Postavsky <npostavs@gmail.com>
Fri, 25 May 2018 11:54:30 +0000 (07:54 -0400)
* 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.

doc/lispref/searching.texi
src/search.c

index fca877117d9f3646b398fe1902e50740de6268a5..6c1ebb22b53f40bcf2e3d0dc31797e8383eec5ab 100644 (file)
@@ -1102,6 +1102,8 @@ comes back" twice.
 @end example
 @end deffn
 
+@c This anchor is referenced by re-search-backward's docstring.
+@anchor{re-search-backward}
 @deffn Command re-search-backward regexp &optional limit noerror count
 This function searches backward in the current buffer for a string of
 text that is matched by the regular expression @var{regexp}, leaving
index 842e9309a2ed1e97d49bc9892a3c0ace25814882..6d010466dcd552ace0c288a3f96d8700bc21136e 100644 (file)
@@ -2233,8 +2233,11 @@ DEFUN ("re-search-backward", Fre_search_backward, Sre_search_backward, 1, 4,
 This function is almost identical to `re-search-forward', except that
 by default it searches backward instead of forward, and the sign of
 COUNT also indicates exactly the opposite searching direction.
+See `re-search-forward' for details.
 
-See `re-search-forward' for details.  */)
+Note that searching backwards may give a shorter match than expected,
+because REGEXP is still matched in the forward direction.  See Info
+anchor `(elisp) re-search-backward' for details.  */)
   (Lisp_Object regexp, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count)
 {
   return search_command (regexp, bound, noerror, count, -1, 1, 0);