Many functions are provided to look at the characters around point.
Several simple functions are described here. See also looking-at
in section Regular Expression Searching.
nil
. The default for
position is point.
In the following example, assume that the first character in the buffer is `@':
(char-to-string (char-after 1)) => "@"
nil
. The default for
position is point.
(char-after (point))
. However, if
point is at the end of the buffer, then following-char
returns 0.
Remember that point is always between characters, and the terminal
cursor normally appears over the character following point. Therefore,
the character returned by following-char
is the character the
cursor is over.
In this example, point is between the `a' and the `c'.
---------- Buffer: foo ---------- Gentlemen may cry ``Pea-!-ce! Peace!,'' but there is no peace. ---------- Buffer: foo ---------- (char-to-string (preceding-char)) => "a" (char-to-string (following-char)) => "c"
following-char
, for an example. If
point is at the beginning of the buffer, preceding-char
returns
0.
t
if point is at the beginning of the
buffer. If narrowing is in effect, this means the beginning of the
accessible portion of the text. See also point-min
in
section Point.
t
if point is at the end of the buffer.
If narrowing is in effect, this means the end of accessible portion of
the text. See also point-max
in See section Point.
t
if point is at the beginning of a line.
See section Motion by Text Lines. The beginning of the buffer (or of its accessible
portion) always counts as the beginning of a line.
t
if point is at the end of a line. The
end of the buffer (or of its accessible portion) is always considered
the end of a line.
Go to the first, previous, next, last section, table of contents.