bongo-patches
[Top][All Lists]
Advanced

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

[bongo-patches] Brian's Boost: Keep all text properties and textual cont


From: Daniel Brockman
Subject: [bongo-patches] Brian's Boost: Keep all text properties and textual content when writing Bongo buffers to disk [...]
Date: Thu, 24 May 2007 13:29:19 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (gnu/linux)

Brian's Boost: Keep all text properties and textual content when
writing Bongo buffers to disk to avoid the need for redisplay
when reading back; this speeds up loading Bongo buffers from
file by a factor of eight (suggested by Brian Palmer).

diff -rN -u old-bongo/bongo.el new-bongo/bongo.el
--- old-bongo/bongo.el  2007-05-24 13:28:50.000000000 +0200
+++ new-bongo/bongo.el  2007-05-24 13:28:50.000000000 +0200
@@ -9735,17 +9735,24 @@
       (unless (looking-at bongo-magic-regexp)
         (error "Unrecognized format"))
       (bongo-delete-line)
-      (while (not (eobp))
-        (let ((start (point)))
-          (condition-case nil
-              (let ((object (read (current-buffer))))
-                (delete-region start (point))
-                (if (stringp object)
-                    (insert object)
-                  (error "Unexpected object: %s" object)))
-            (end-of-file
-             (delete-region start (point-max))))))
-      (bongo-redisplay-region (point-min) (point-max))
+      (let ((original-buffer-size (- end beg))
+            (iteration 0))
+        (while (not (eobp))
+          (when (zerop (% (setq iteration (+ iteration 1)) 500))
+            (message "Reading Bongo buffer...%d%%"
+                     (/ (* 100.0 (- original-buffer-size
+                                    (- (point-max) (point))))
+                        original-buffer-size)))
+          (let ((start (point)))
+            (condition-case nil
+                (let ((object (read (current-buffer))))
+                  (delete-region start (point))
+                  (if (stringp object)
+                      (insert object)
+                    (error "Unexpected object: %s" object)))
+              (end-of-file
+               (delete-region start (point-max)))))))
+      (message "Reading Bongo buffer...done") 
       (point-max))))
 
 (defvar bongo-line-serializable-properties
@@ -9776,14 +9783,11 @@
                   bongo-playlist-magic-string
                 bongo-library-magic-string) "\n")
       (while (not (eobp))
-        (when (bongo-object-line-p)
-          (delete-region (point-at-bol) (point-at-eol)))
-        (bongo-keep-text-properties (point-at-bol) (point-at-eol)
-                                    '(face mouse-face display follow-link))
         (bongo-keep-text-properties (point-at-eol) (1+ (point-at-eol))
                                     bongo-line-serializable-properties)
         (prin1 (bongo-extract-line) (current-buffer))
-        (insert "\n")))))
+        (insert "\n"))
+      (point-max))))
 
 
 ;;;; Bongo Dired Library mode
-- 
Daniel Brockman <address@hidden>

reply via email to

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