From 6cfe977d9f4cc0ac1321ef25a18c4f2a7d5fb9b1 Mon Sep 17 00:00:00 2001 From: Xue Fuqiao Date: Sun, 29 Sep 2013 14:16:45 +0800 Subject: [PATCH] Refine documentation of `looking-back'. * lisp/subr.el (looking-back): Do not recommend using looking-back. (bug#5689) * doc/lispref/searching.texi (Regexp Search): Refine. --- doc/lispref/ChangeLog | 4 ++++ doc/lispref/searching.texi | 14 +++++++------- lisp/ChangeLog | 4 ++++ lisp/subr.el | 5 ++++- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 2fa3fc13e3..4a55b17127 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,7 @@ +2013-09-29 Xue Fuqiao + + * searching.texi (Regexp Search): Refine. + 2013-09-22 Xue Fuqiao * nonascii.texi (Default Coding Systems): Typo fix. diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 386d5bdde4..993c2b2677 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -1146,13 +1146,7 @@ implemented by searching backwards from point for a match that ends at point. That can be quite slow if it has to search a long distance. You can bound the time required by specifying @var{limit}, which says not to search before @var{limit}. In this case, the match that is -found must begin at or after @var{limit}. - -If @var{greedy} is non-@code{nil}, this function extends the match -backwards as far as possible, stopping when a single additional -previous character cannot be part of a match for regexp. When the -match is extended, its starting position is allowed to occur before -@var{limit}. +found must begin at or after @var{limit}. Here's an example: @example @group @@ -1168,6 +1162,12 @@ comes back" twice. @end group @end example +If @var{greedy} is non-@code{nil}, this function extends the match +backwards as far as possible, stopping when a single additional +previous character cannot be part of a match for regexp. When the +match is extended, its starting position is allowed to occur before +@var{limit}. + @c http://debbugs.gnu.org/5689 As a general recommendation, try to avoid using @code{looking-back} wherever possible, since it is slow. For this reason, there are no diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9a04acfa68..9395df089b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2013-09-29 Xue Fuqiao + + * subr.el (looking-back): Do not recommend using looking-back. + 2013-09-28 Alan Mackenzie Fix indentation/fontification of Java enum with "implements". diff --git a/lisp/subr.el b/lisp/subr.el index 43be9f529b..ba240a2706 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3482,7 +3482,10 @@ If GREEDY is non-nil, extend the match backwards as far as possible, stopping when a single additional previous character cannot be part of a match for REGEXP. When the match is extended, its starting position is allowed to occur before -LIMIT." +LIMIT. + +As a general recommendation, try to avoid using `looking-back' +wherever possible, since it is slow." (let ((start (point)) (pos (save-excursion -- 2.20.1