[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
beginning-of-buffer computations
From: |
Marcin Borkowski |
Subject: |
beginning-of-buffer computations |
Date: |
Thu, 29 Jan 2015 21:26:18 +0100 |
Hello people,
I'm continuing my journey through simple.el, and I've just found
something strange. Apparently, a PhD in maths is not enough to grok the
arithmetic operations in beginning-of-buffer...;-)
(goto-char (if (and arg (not (consp arg)))
(+ (point-min)
(if (> size 10000)
;; Avoid overflow for large buffer sizes!
(* (prefix-numeric-value arg)
(/ size 10))
(/ (+ 10 (* size (prefix-numeric-value arg))) 10)))
(point-min)))
Now I pretty much see what is going on for "large buffers". For smaller
ones, I'm wondering what is the rationale behind the `+ 10' part? It
approximately adds one to the result (of course, the result is truncated
to the next-lower-integer, so it's not that, ekhm, simple) - but why?
(Not to mention the next line - not shown here - which `forward-line's
by 1. Why not just (beginning-of-line) instead?)
TIA,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
- beginning-of-buffer computations,
Marcin Borkowski <=