aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2005-06-08 15:34:13 +0000
committerRichard M. Stallman2005-06-08 15:34:13 +0000
commit8135a25a77598b1673852f12bd0cdeeab0790752 (patch)
tree559062c6dc77373ef84735392ad68021820a0437
parentb74f585b6b787349a5a0dda29fe788baa0f3d6c9 (diff)
downloademacs-8135a25a77598b1673852f12bd0cdeeab0790752.tar.gz
emacs-8135a25a77598b1673852f12bd0cdeeab0790752.zip
(Entire Match Data): Clarify when match-data
returns markers and when integers.
-rw-r--r--lispref/searching.texi33
1 files changed, 16 insertions, 17 deletions
diff --git a/lispref/searching.texi b/lispref/searching.texi
index 1f4a82d3f1f..01d055c4a45 100644
--- a/lispref/searching.texi
+++ b/lispref/searching.texi
@@ -1486,12 +1486,13 @@ character of the buffer counts as 1.)
1486write the entire match data, all at once. 1486write the entire match data, all at once.
1487 1487
1488@defun match-data &optional integers reuse 1488@defun match-data &optional integers reuse
1489This function returns a newly constructed list containing all the 1489This function returns a list of positions (markers or integers) that
1490information on what text the last search matched. Element zero is the 1490record all the information on what text the last search matched.
1491position of the beginning of the match for the whole expression; element 1491Element zero is the position of the beginning of the match for the
1492one is the position of the end of the match for the expression. The 1492whole expression; element one is the position of the end of the match
1493next two elements are the positions of the beginning and end of the 1493for the expression. The next two elements are the positions of the
1494match for the first subexpression, and so on. In general, element 1494beginning and end of the match for the first subexpression, and so on.
1495In general, element
1495@ifnottex 1496@ifnottex
1496number 2@var{n} 1497number 2@var{n}
1497@end ifnottex 1498@end ifnottex
@@ -1508,15 +1509,13 @@ number {\mathsurround=0pt $2n+1$}
1508@end tex 1509@end tex
1509corresponds to @code{(match-end @var{n})}. 1510corresponds to @code{(match-end @var{n})}.
1510 1511
1511All the elements are markers or @code{nil} if matching was done on a 1512Normally all the elements are markers or @code{nil}, but if
1512buffer and all are integers or @code{nil} if matching was done on a 1513@var{integers} is non-@code{nil}, that means to use integers instead
1513string with @code{string-match}. If @var{integers} is 1514of markers. (In that case, the buffer itself is appended as an
1514non-@code{nil}, then the elements are integers or @code{nil}, even if 1515additional element at the end of the list, to facilitate complete
1515matching was done on a buffer. In that case, the buffer itself is 1516restoration of the match data.) If the last match was done on a
1516appended as an additional element at the end of the list 1517string with @code{string-match}, then integers are always used,
1517to facilitate complete restoration of the match data. Also, 1518since markers can't point into a string.
1518@code{match-beginning} and
1519@code{match-end} always return integers or @code{nil}.
1520 1519
1521If @var{reuse} is non-@code{nil}, it should be a list. In that case, 1520If @var{reuse} is non-@code{nil}, it should be a list. In that case,
1522@code{match-data} stores the match data in @var{reuse}. That is, 1521@code{match-data} stores the match data in @var{reuse}. That is,
@@ -1524,8 +1523,8 @@ If @var{reuse} is non-@code{nil}, it should be a list. In that case,
1524have the right length. If it is not long enough to contain the match 1523have the right length. If it is not long enough to contain the match
1525data, it is extended. If it is too long, the length of @var{reuse} 1524data, it is extended. If it is too long, the length of @var{reuse}
1526stays the same, but the elements that were not used are set to 1525stays the same, but the elements that were not used are set to
1527@code{nil}. The purpose of this feature is to avoid producing too 1526@code{nil}. The purpose of this feature is to reduce the need for
1528much garbage, that would later have to be collected. 1527garbage collection.
1529 1528
1530As always, there must be no possibility of intervening searches between 1529As always, there must be no possibility of intervening searches between
1531the call to a search function and the call to @code{match-data} that is 1530the call to a search function and the call to @code{match-data} that is