emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/vlf 36411c3 022/310: Enhance search to cover in between


From: Stefan Monnier
Subject: [elpa] externals/vlf 36411c3 022/310: Enhance search to cover in between chunk boundaries.
Date: Sat, 28 Nov 2020 00:32:39 -0500 (EST)

branch: externals/vlf
commit 36411c363251bc0f28921e030d456bbb3d2d9034
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>

    Enhance search to cover in between chunk boundaries.
---
 vlfi.el | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/vlfi.el b/vlfi.el
index 3d7a55e..1a2eccb 100644
--- a/vlfi.el
+++ b/vlfi.el
@@ -246,7 +246,9 @@ OP-TYPE specifies the file operation being performed over 
FILENAME."
                           (if backward
                               (- vlfi-file-size vlfi-start-pos)
                             vlfi-start-pos)
-                          vlfi-file-size)))
+                          vlfi-file-size))
+        (initial-chunk t)
+        (prev 0))
     (unwind-protect
         (catch 'end-of-file
           (if backward
@@ -255,7 +257,12 @@ OP-TYPE specifies the file operation being performed over 
FILENAME."
                        (setq to-find (1- to-find)))
                       ((zerop vlfi-start-pos)
                        (throw 'end-of-file nil))
-                      (t (vlfi-prev-batch 1)
+                      (t (if initial-chunk
+                             (setq initial-chunk nil)
+                           (let ((inhibit-read-only t))
+                             (delete-region prev (point-max))))
+                         (setq prev (point-min))
+                         (vlfi-prev-batch -1)
                          (progress-reporter-update
                           search-reporter (- vlfi-file-size
                                              vlfi-end-pos)))))
@@ -264,7 +271,12 @@ OP-TYPE specifies the file operation being performed over 
FILENAME."
                      (setq to-find (1- to-find)))
                     ((= vlfi-end-pos vlfi-file-size)
                      (throw 'end-of-file nil))
-                    (t (vlfi-next-batch 1)
+                    (t (if initial-chunk
+                           (setq initial-chunk nil)
+                         (let ((inhibit-read-only t))
+                           (delete-region (point-min) prev)))
+                       (setq prev (point-max))
+                       (vlfi-next-batch -1)
                        (progress-reporter-update search-reporter
                                                  vlfi-end-pos))))))
       (progress-reporter-done search-reporter)



reply via email to

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