* doc/lispref/positions.texi (Text Lines): Document count-words.

This commit is contained in:
Chong Yidong 2012-03-05 14:12:17 +08:00
parent 10607bea34
commit ef959d3a0c
3 changed files with 15 additions and 12 deletions

View file

@ -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

View file

@ -1,3 +1,7 @@
2012-03-05 Chong Yidong <cyd@gnu.org>
* positions.texi (Text Lines): Document count-words.
2012-03-04 Chong Yidong <cyd@gnu.org>
* frames.texi (Frames): Remove little-used "terminal frame" and

View file

@ -372,19 +372,18 @@ 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.
Here is an example of using @code{count-lines}:
@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
@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.
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
This function returns the line number in the current buffer