Finally, let’s look at several rather simple functions,
point-max. These give information about the size of a buffer and
the location of point within it.
buffer-size tells you the size of the current
buffer; that is, the function returns a count of the number of
characters in the buffer.
You can evaluate this in the usual way, by positioning the cursor after the expression and typing C-x C-e.
In Emacs, the current position of the cursor is called point.
(point) returns a number that tells you where the
cursor is located as a count of the number of characters from the
beginning of the buffer up to point.
You can see the character count for point in this buffer by evaluating the following expression in the usual way:
As I write this, the value of
point is 65724. The
function is frequently used in some of the examples later in this
The value of point depends, of course, on its location within the buffer. If you evaluate point in this spot, the number will be larger:
For me, the value of point in this location is 66043, which means that there are 319 characters (including spaces) between the two expressions. (Doubtless, you will see different numbers, since I will have edited this since I first evaluated point.)
point-min is somewhat similar to
it returns the value of the minimum permissible value of point in the
current buffer. This is the number 1 unless narrowing is in
effect. (Narrowing is a mechanism whereby you can restrict yourself,
or a program, to operations on just a part of a buffer.
See Narrowing and Widening.) Likewise, the
point-max returns the value of the maximum permissible
value of point in the current buffer.