[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Here are commands to get information about the size and position of parts of the buffer, and to count lines.
count-lines-region
).
See section H. The Mark and the Region, for information about the region.
what-cursor-position
).
There are two commands for working with line numbers. M-x what-line computes the current line number and displays it in the echo area. To go to a given line by number, use M-x goto-line; it prompts you for the number. These line numbers count from one at the beginning of the buffer.
You can also see the current line number in the mode line; see B.3 The Mode Line. If you narrow the buffer, then the line number in the mode line
is relative to the accessible portion (see section AC.22 Narrowing). By contrast,
what-line
shows both the line number relative to the narrowed
region and the line number relative to the whole buffer.
M-x what-page counts pages from the beginning of the file, and counts lines within the page, showing both numbers in the echo area. See section T.4 Pages.
While on this subject, we might as well mention M-= (count-lines-region
),
which displays the number of lines in the region (see section H. The Mark and the Region).
See section T.4 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 displays a line in the echo area that looks like this:
Char: c (0143, 99, 0x63) point=21044 of 26883(78%) column 53 |
(In fact, this is the output produced when point is before the `column' in the example.)
The four values after `Char:' describe the character that follows point, first by showing it and then by giving its character code in octal, decimal and hex. For a non-ASCII multibyte character, these are followed by `ext' and the character's representation, in hex, in the buffer's coding system, if that coding system encodes the character safely and with a single byte (see section Q.7 Coding Systems). If the character's encoding is longer than one byte, Emacs shows `ext ...'.
`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.
`column' 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 inaccessible, C-x = displays additional text describing the currently accessible range. For example, it might display this:
Char: C (0103, 67, 0x43) point=252 of 889(28%) <231 - 599> column 0 |
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. See section AC.22 Narrowing.
If point is at the end of the buffer (or the end of the accessible part), the C-x = output does not describe a character after point. The output might look like this:
point=26957 of 26956(100%) column 0 |
C-u C-x = displays additional information about a character,
in place of the buffer coordinates and column: the character set name
and the codes that identify the character within that character set;
ASCII characters are identified as belonging to the ASCII
character set. In addition, the full character encoding, even if it
takes more than a single byte, is shown after `ext'. Here's an
example for a Latin-1 character A with a grave accent in a buffer whose
coding system is iso-2022-7bit(1):
Char: À (04300, 2240, 0x8c0, ext ESC , A @) (latin-iso8859-1 64) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |