www.delorie.com/gnu/docs/emacs-lisp-intro/emacs-lisp-intro_98.html   search  
 
Buy the book!


Programming in Emacs Lisp

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.3.2 beginning-of-buffer with an Argument

When beginning-of-buffer is called with an argument, an expression is evaluated which calculates what value to pass to goto-char. This expression is rather complicated at first sight. It includes an inner if expression and much arithmetic. It looks like this:

 
(if (> (buffer-size) 10000)
    ;; Avoid overflow for large buffer sizes!
    (* (prefix-numeric-value arg) (/ (buffer-size) 10))
  (/
   (+ 10
      (*
       (buffer-size) (prefix-numeric-value arg))) 10))

Disentangle beginning-of-buffer  
What happens in a large buffer  
What happens in a small buffer  


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003