bongo-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bongo-patches] Make random playback choose random _lines_ instead of ra


From: Daniel Brockman
Subject: [bongo-patches] Make random playback choose random _lines_ instead of random buffer positions
Date: Sat, 17 Mar 2007 21:32:58 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (gnu/linux)

2007-03-17  Anthony Chaumas-Pellet  <address@hidden>

        Make random playback choose random _lines_ instead of random
        buffer positions.

diff -rN -u old-bongo/bongo.el new-bongo/bongo.el
--- old-bongo/bongo.el  2007-03-17 21:31:43.000000000 +0100
+++ new-bongo/bongo.el  2007-03-17 21:31:43.000000000 +0100
@@ -2236,9 +2236,9 @@
   "Return the position of a random line satisfying PREDICATE.
 If there are no lines that satisfy PREDICATE, loop forever."
   (save-excursion
-    (while (progn (goto-char (+ (point-min)
-                                (random (- (point-max)
-                                           (point-min)))))
+    (while (progn (goto-line (+ (point-min)
+                                (random (count-lines (point-max)
+                                                     (point-min)))))
                   (not (funcall predicate))))
     (point)))
 
-- 
Daniel Brockman <address@hidden>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]