From ef959d3a0cb5cbb5a4ea2b0d6e6e50cb4356cb86 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 5 Mar 2012 14:12:17 +0800 Subject: [PATCH] * doc/lispref/positions.texi (Text Lines): Document count-words. --- admin/FOR-RELEASE | 2 +- doc/lispref/ChangeLog | 4 ++++ doc/lispref/positions.texi | 19 +++++++++---------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE index 636d400f5cb..99b702ad30f 100644 --- a/admin/FOR-RELEASE +++ b/admin/FOR-RELEASE @@ -219,7 +219,7 @@ numbers.texi cyd objects.texi cyd os.texi package.texi -positions.texi +positions.texi cyd processes.texi searching.texi sequences.texi cyd diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 51eed431ca2..7f11c65f9e1 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,7 @@ +2012-03-05 Chong Yidong + + * positions.texi (Text Lines): Document count-words. + 2012-03-04 Chong Yidong * frames.texi (Frames): Remove little-used "terminal frame" and diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi index 29b338369e5..99722c93902 100644 --- a/doc/lispref/positions.texi +++ b/doc/lispref/positions.texi @@ -372,18 +372,17 @@ This function returns the number of lines between the positions 1, even if @var{start} and @var{end} are on the same line. This is because the text between them, considered in isolation, must contain at least one line unless it is empty. +@end defun -Here is an example of using @code{count-lines}: +@deffn Command count-words start end +@cindex words in region +This function returns the number of words between the positions +@var{start} and @var{end} in the current buffer. -@example -@group -(defun current-line () - "Return the vertical position of point@dots{}" - (+ (count-lines (window-start) (point)) - (if (= (current-column) 0) 1 0))) -@end group -@end example -@end defun +This function can also be called interactively. In that case, it +prints a message reporting the number of lines, words, and characters +in the buffer, or in the region if the region is active. +@end deffn @defun line-number-at-pos &optional pos @cindex line number -- 2.11.4.GIT