eintr: Small buffer case
What happens in a small buffer
..............................
If the buffer contains fewer than 10,000 characters, a slightly
different computation is performed. You might think this is not
necessary, since the first computation could do the job. However, in a
small buffer, the first method may not put the cursor on exactly the
desired line; the second method does a better job.
The code looks like this:
(/ (+ 10 (* size (prefix-numeric-value arg))) 10))
This is code in which you figure out what happens by discovering how the
functions are embedded in parentheses. It is easier to read if you
reformat it with each expression indented more deeply than its enclosing
expression:
(/
(+ 10
(*
size
(prefix-numeric-value arg)))
10))
Looking at parentheses, we see that the innermost operation is
‘(prefix-numeric-value arg)’, which converts the raw argument to a
number. In the following expression, this number is multiplied by the
size of the accessible portion of the buffer:
(* size (prefix-numeric-value arg))
This multiplication creates a number that may be larger than the size of
the buffer—seven times larger if the argument is 7, for example. Ten is
then added to this number and finally the large number is divided by ten
to provide a value that is one character larger than the percentage
position in the buffer.
The number that results from all this is passed to ‘goto-char’ and
the cursor is moved to that point.