]> code.delx.au - gnu-emacs/blobdiff - doc/lispref/searching.texi
(Standard Keymaps): Rename function-key-map to local-function-key-map.
[gnu-emacs] / doc / lispref / searching.texi
index 6bca6c79f2722476b1c2326d2dfc543842808cd7..eea165d1c1f1a11c20b5682056fccc98a37de46a 100644 (file)
@@ -1,7 +1,7 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001,
-@c   2002, 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+@c   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../../info/searching
 @node Searching and Matching, Syntax Tables, Non-ASCII Characters, Top
@@ -334,6 +334,7 @@ preceding expression either once or not at all.  For example,
 @samp{ca?r} matches @samp{car} or @samp{cr}; nothing else.
 
 @item @samp{*?}, @samp{+?}, @samp{??}
+@cindex non-greedy repetition characters in regexp
 These are ``non-greedy'' variants of the operators @samp{*}, @samp{+}
 and @samp{?}.  Where those operators match the largest possible
 substring (consistent with matching the entire containing expression),
@@ -1060,6 +1061,11 @@ the match is available as @code{(match-end 0)}.  @xref{Match Data}.
 @end example
 @end defun
 
+@defun string-match-p regexp string &optional start
+This predicate function does what @code{string-match} does, but it
+avoids modifying the match data.
+@end defun
+
 @defun looking-at regexp
 This function determines whether the text in the current buffer directly
 following point matches the regular expression @var{regexp}.  ``Directly
@@ -1069,7 +1075,8 @@ result is @code{t} if so, @code{nil} otherwise.
 
 This function does not move point, but it updates the match data, which
 you can access using @code{match-beginning} and @code{match-end}.
-@xref{Match Data}.
+@xref{Match Data}.  If you need to test for a match without modifying
+the match data, use @code{looking-at-p}, described below.
 
 In this example, point is located directly before the @samp{T}.  If it
 were anywhere else, the result would be @code{nil}.
@@ -1087,7 +1094,7 @@ comes back" twice.
 @end example
 @end defun
 
-@defun looking-back regexp &optional limit
+@defun looking-back regexp &optional limit greedy
 This function returns @code{t} if @var{regexp} matches text before
 point, ending at point, and @code{nil} otherwise.
 
@@ -1098,6 +1105,12 @@ 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}.
+
 @example
 @group
 ---------- Buffer: foo ----------
@@ -1113,6 +1126,11 @@ comes back" twice.
 @end example
 @end defun
 
+@defun looking-at-p regexp
+This predicate function works like @code{looking-at}, but without
+updating the match data.
+@end defun
+
 @defvar search-spaces-regexp
 If this variable is non-@code{nil}, it should be a regular expression
 that says how to search for whitespace.  In that case, any group of
@@ -1142,8 +1160,9 @@ match, as required by POSIX.  This is much slower, so use these
 functions only when you really need the longest match.
 
   The POSIX search and match functions do not properly support the
-non-greedy repetition operators.  This is because POSIX backtracking
-conflicts with the semantics of non-greedy repetition.
+non-greedy repetition operators (@pxref{Regexp Special, non-greedy}).
+This is because POSIX backtracking conflicts with the semantics of
+non-greedy repetition.
 
 @defun posix-search-forward regexp &optional limit noerror repeat
 This is like @code{re-search-forward} except that it performs the full
@@ -1395,7 +1414,7 @@ subexpression is at the 13th character (@samp{c}).
   (re-search-forward "The \\(cat \\)")
   (match-beginning 0)
   (match-beginning 1))
-    @result{} (9 9 13)
+    @result{} (17 9 13)
 @end group
 
 @group
@@ -1719,6 +1738,12 @@ use this answer.
 Display some help, then ask again.
 @end table
 
+@defvar multi-query-replace-map
+This variable holds a keymap that extends @code{query-replace-map} by
+providing additional keybindings that are useful in multi-buffer
+replacements.
+@end defvar
+
 @defvar replace-search-function
 This variable specifies a function that @code{perform-replace} calls
 to search for the next string to replace.  Its default value is