Node:Disentangle beginning-of-buffer, Next:, Previous:beginning-of-buffer opt arg, Up:beginning-of-buffer opt arg



Disentangle beginning-of-buffer

Like other complex-looking expressions, the conditional expression within beginning-of-buffer can be disentangled by looking at it as parts of a template, in this case, the template for an if-then-else expression. In skeletal form, the expression looks like this:

(if (buffer-is-large
    divide-buffer-size-by-10-and-multiply-by-arg
  else-use-alternate-calculation

The true-or-false-test of this inner if expression checks the size of the buffer. The reason for this is that the old Version 18 Emacs used numbers that are no bigger than eight million or so and in the computation that followed, the programmer feared that Emacs might try to use over-large numbers if the buffer were large. The term `overflow', mentioned in the comment, means numbers that are over large. Version 21 Emacs uses larger numbers, but this code has not been touched, if only because people now look at buffers that are far, far larger than ever before.

There are two cases: if the buffer is large and if it is not.