(emacs)Position Info


Next: Arguments Prev: Continuation Lines Up: Basic

Cursor Position Information
===========================

   Here are commands to get information about the size and position of
parts of the buffer, and to count lines.

`M-x what-page'
     Print page number of point, and line number within page.

`M-x what-line'
     Print line number of point in the buffer.

`M-x line-number-mode'
     Toggle automatic display of current line number.

`M-='
     Print number of lines in the current region (`count-lines-region').

`C-x ='
     Print character code of character after point, character position
     of point, and column of point (`what-cursor-position').

   There are two commands for printing the current line number.  `M-x
what-line' computes the current line number and displays it in the echo
area.  `M-x line-number-mode' enables display of the current line
number in the mode line; once you turn this on, the number updates as
you move point, so it remains valid all the time.  Note: Mode Line.

   Line numbers count from one at the beginning of the buffer.  To go to
a given line by number, use `M-x goto-line'; it prompts you for the
line number.

   By contrast, `M-x what-page' counts pages from the beginning of the
file, and counts lines within the page, printing both numbers.  *Note
Pages::.

   While on this subject, we might as well mention `M-='
(`count-lines-region'), which prints the number of lines in the region
(Note: Mark.).  Note: Pages, for the command `C-x l' which counts
the lines in the current page.

   The command `C-x =' (`what-cursor-position') can be used to find out
the column that the cursor is in, and other miscellaneous information
about point.  It prints a line in the echo area that looks like this:

     Char: x (0170)  point=65986 of 563027(12%)  x=44

(In fact, this is the output produced when point is before the `x=44'
in the example.)

   The two values after `Char:' describe the character that follows
point, first by showing it and second by giving its octal character
code.

   `point=' is followed by the position of point expressed as a
character count.  The front of the buffer counts as position 1, one
character later as 2, and so on.  The next, larger number is the total
number of characters in the buffer.  Afterward in parentheses comes the
position expressed as a percentage of the total size.

   `x=' is followed by the horizontal position of point, in columns
from the left edge of the window.

   If the buffer has been narrowed, making some of the text at the
beginning and the end temporarily off limits, `C-x =' prints additional
text describing the currently accessible range.  For example, it might
display this:

     Char: x (0170)  point=65986 of 563025(12%) <65102 - 68533>  x=44

where the two extra numbers give the smallest and largest character
position that point is allowed to assume.  The characters between those
two positions are the accessible ones.  Note: Narrowing.

   If point is at the end of the buffer (or the end of the accessible
part), `C-x =' omits any description of the character after point.  The
output looks like this:

     point=563026 of 563025(100%)  x=0


automatically generated by info2www