summaryrefslogtreecommitdiff
path: root/doc/lispref/positions.texi
diff options
context:
space:
mode:
authorChong Yidong <cyd@gnu.org>2012-03-05 14:12:17 +0800
committerChong Yidong <cyd@gnu.org>2012-03-05 14:12:17 +0800
commitef959d3a0cb5cbb5a4ea2b0d6e6e50cb4356cb86 (patch)
tree9c6a51a3174b84e0e2991ec26278ea33818bc3f6 /doc/lispref/positions.texi
parent10607bea34d2cddc62761df6c88d674c2861e71d (diff)
downloademacs-ef959d3a0cb5cbb5a4ea2b0d6e6e50cb4356cb86.tar.gz
emacs-ef959d3a0cb5cbb5a4ea2b0d6e6e50cb4356cb86.tar.bz2
emacs-ef959d3a0cb5cbb5a4ea2b0d6e6e50cb4356cb86.zip
* doc/lispref/positions.texi (Text Lines): Document count-words.
Diffstat (limited to 'doc/lispref/positions.texi')
-rw-r--r--doc/lispref/positions.texi19
1 files changed, 9 insertions, 10 deletions
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