GNU Emacs
Emacs
Dashboard

Cursor Position Information

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

M-x what-line
Display the line number of point.
M-x line-number-mode, M-x column-number-mode
Toggle automatic display of the current line number or column number. Optional Mode Line. If you want to have a line number displayed before each line, see Display Custom.
M-=
Display the number of lines, sentences, words, and characters that are present in the region (count-words-region). Mark, for information about the region.
M-x count-words
Display the number of lines, sentences, words, and characters that are present in the buffer. If the region is active (Mark), display the numbers for the region instead.
C-x =
Display the character code of character after point, character position of point, and column of point (what-cursor-position).
M-x hl-line-mode
Enable or disable highlighting of the current line. Cursor Display.
M-x size-indication-mode
Toggle automatic display of the size of the buffer. Optional Mode Line.

M-x what-line displays the current line number in the echo area. This command is usually redundant because the current line number is shown in the mode line (Mode Line). However, if you narrow the buffer, the mode line shows the line number relative to the accessible portion (Narrowing). By contrast, what-line displays both the line number relative to the narrowed region and the line number relative to the whole buffer. M-= (count-words-region) displays a message reporting the number of lines, sentences, words, and characters in the region (Mark, for an explanation of the region). With a prefix argument, C-u M-=, the command displays a count for the entire buffer. The command M-x count-words does the same job, but with a different calling convention. It displays a count for the region if the region is active, and for the buffer otherwise. The command C-x = (what-cursor-position) shows information about the current cursor position and the buffer contents at that position. It displays a line in the echo area that looks like this:

Char: c (99, #o143, #x63) point=28062 of 36168 (78%) column=53

After Char:, this shows the character in the buffer at point. The text inside the parenthesis shows the corresponding decimal, octal and hex character codes; for more information about how C-x = displays character information, see International Chars. After point= is the position of point as a character count (the first character in the buffer is position 1, the second character is position 2, and so on). The number after that is the total number of characters in the buffer, and the number in parenthesis expresses the position as a percentage of the total. After column= is the horizontal position of point, in columns counting from the left edge of the window. If the user option what-cursor-show-names is non-nil, the name of the character, as defined by the Unicode Character Database, is shown as well. The part in parentheses would then become:

(99, #o143, #x63, LATIN SMALL LETTER C)

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 (67, #o103, #x43) point=252 of 889 (28%) <231-599> column=0

@noindent 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. Narrowing. Related, but different feature is display-line-numbers-mode (Display Custom).