emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-26 2f44d2d: Note caveat for backward regexp searchin


From: Noam Postavsky
Subject: [Emacs-diffs] emacs-26 2f44d2d: Note caveat for backward regexp searching in docstring (Bug#31584)
Date: Fri, 25 May 2018 07:58:50 -0400 (EDT)

branch: emacs-26
commit 2f44d2d5b15008fde44a56ca24f0c3b6b9e63faf
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    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.
---
 doc/lispref/searching.texi | 2 ++
 src/search.c               | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi
index fca8771..6c1ebb2 100644
--- a/doc/lispref/searching.texi
+++ b/doc/lispref/searching.texi
@@ -1102,6 +1102,8 @@ comes back" twice.
 @end example
 @end deffn
 
address@hidden This anchor is referenced by re-search-backward's docstring.
address@hidden
 @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
diff --git a/src/search.c b/src/search.c
index 842e930..6d01046 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,
 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);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]