(lemacs.info)Position Info

Next: Arguments Prev: Continuation Lines Up: Basic

Cursor Position Information

   If you are accustomed to other display editors, you may be surprised
that Emacs does not always display the page number or line number of
point in the mode line.  In Emacs, this information is only rarely
needed, and a number of commands are available to compute and print it.
Since text is stored in a way that makes it difficult to compute the
information, it is not displayed all the time.

`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.

     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 several commands for printing line numbers:
   * `M-x what-line' counts lines from the beginning of the file and
     prints the line number point is on.  The first line of the file is
     line number 1.  You can use these numbers as arguments to `M-x

   * `M-x what-page' counts pages from the beginning of the file, and
     counts lines within the page, printing both of them.  *Note
     Pages::, for the command `C-x l', which counts the lines in the
     current page.

   * `M-=' (`count-lines-region') prints the number of lines in the
     region (Note: Mark.).

   The command `C-x =' (`what-cursor-position') provides information
about point and about the column the cursor is in.  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 following 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 invisible, `C-x =' prints additional
text describing the current visible range.  For example, it might say:

     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 visible ones.  Note: Narrowing.

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

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

automatically generated by info2www