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

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

[elpa] externals/vlf 2e9ff70 238/310: Enlarge default batch size but kee


From: Stefan Monnier
Subject: [elpa] externals/vlf 2e9ff70 238/310: Enlarge default batch size but keep is small on initial load of remote
Date: Sat, 28 Nov 2020 00:33:23 -0500 (EST)

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

    Enlarge default batch size but keep is small on initial load of remote
    files and on demand.
---
 vlf-base.el      |  2 +-
 vlf-ediff.el     |  5 ++---
 vlf-integrate.el |  2 +-
 vlf-occur.el     |  4 ++--
 vlf.el           | 15 ++++++++++-----
 5 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/vlf-base.el b/vlf-base.el
index cc04fee..30e9b27 100644
--- a/vlf-base.el
+++ b/vlf-base.el
@@ -27,7 +27,7 @@
 
 ;;; Code:
 
-(defcustom vlf-batch-size 1024
+(defcustom vlf-batch-size 1000000
   "Defines how large each batch of file data initially is (in bytes)."
   :group 'vlf :type 'integer)
 (put 'vlf-batch-size 'permanent-local t)
diff --git a/vlf-ediff.el b/vlf-ediff.el
index 866ddc2..ef9d5c7 100644
--- a/vlf-ediff.el
+++ b/vlf-ediff.el
@@ -34,7 +34,6 @@
   "If non nil, specifies that ediff is done over VLF buffers.")
 (make-variable-buffer-local 'vlf-ediff-session)
 
-;;;###autoload
 (defun vlf-ediff-buffers (buffer-A buffer-B)
   "Run batch by batch ediff over VLF buffers BUFFER-A and BUFFER-B.
 Batch size is determined by the size in BUFFER-A.
@@ -93,10 +92,10 @@ respectively of difference list, runs ediff over the 
adjacent chunks."
                                       dir-B)))
                                    (ediff-get-default-file-name f 1)))
            (read-number "Batch size (in bytes): " vlf-batch-size))))
-  (let ((buffer-A (vlf file-A)))
+  (let ((buffer-A (vlf file-A t)))
     (set-buffer buffer-A)
     (vlf-set-batch-size batch-size)
-    (let ((buffer-B (vlf file-B)))
+    (let ((buffer-B (vlf file-B t)))
       (vlf-ediff-buffers buffer-A buffer-B))))
 
 (defadvice ediff-next-difference (around vlf-ediff-next-difference
diff --git a/vlf-integrate.el b/vlf-integrate.el
index aa65b76..7bc8f94 100644
--- a/vlf-integrate.el
+++ b/vlf-integrate.el
@@ -29,7 +29,7 @@
 (defgroup vlf nil "View Large Files in Emacs."
   :prefix "vlf-" :group 'files)
 
-(defcustom vlf-batch-size 1024
+(defcustom vlf-batch-size 1000000
   "Defines how large each batch of file data initially is (in bytes)."
   :group 'vlf :type 'integer)
 
diff --git a/vlf-occur.el b/vlf-occur.el
index 40d7e1d..2dac4a4 100644
--- a/vlf-occur.el
+++ b/vlf-occur.el
@@ -123,7 +123,7 @@ EVENT may hold details of the invocation."
               (match-pos (+ (get-text-property pos 'line-pos)
                             pos-relative)))
           (cond (current-prefix-arg
-                 (setq vlf-buffer (vlf file))
+                 (setq vlf-buffer (vlf file t))
                  (or not-hexl (hexl-mode))
                  (switch-to-buffer occur-buffer))
                 ((not (buffer-live-p vlf-buffer))
@@ -136,7 +136,7 @@ EVENT may hold details of the invocation."
                                       not-hexl)
                                   (setq vlf-buffer buf)
                                   (throw 'found t))))
-                   (setq vlf-buffer (vlf file))
+                   (setq vlf-buffer (vlf file t))
                    (or not-hexl (hexl-mode)))
                  (switch-to-buffer occur-buffer)
                  (setq vlf-occur-vlf-buffer vlf-buffer)))
diff --git a/vlf.el b/vlf.el
index 8a9fde3..8acd54e 100644
--- a/vlf.el
+++ b/vlf.el
@@ -145,17 +145,22 @@ values are: `write', `ediff', `occur', `search', 
`goto-line'."
   (setq vlf-mode t))
 
 ;;;###autoload
-(defun vlf (file)
-  "View Large FILE in batches.
+(defun vlf (file &optional minimal)
+  "View Large FILE in batches.  When MINIMAL load just a few bytes.
 You can customize number of bytes displayed by customizing
 `vlf-batch-size'.
 Return newly created buffer."
-  (interactive "fFile to open: ")
+  (interactive (list (read-file-name "File to open: ") nil))
   (let ((vlf-buffer (generate-new-buffer "*vlf*")))
     (set-buffer vlf-buffer)
     (set-visited-file-name file)
     (set-buffer-modified-p nil)
+    (if (or minimal (file-remote-p file))
+        (set (make-local-variable 'vlf-batch-size) 1024))
     (vlf-mode 1)
+    (when minimal                 ;restore batch size to default value
+      (kill-local-variable 'vlf-batch-size)
+      (make-local-variable 'vlf-batch-size))
     (switch-to-buffer vlf-buffer)
     vlf-buffer))
 
@@ -263,8 +268,8 @@ with the prefix argument DECREASE it is halved."
   (vlf-verify-size)
   (vlf-move-to-batch vlf-file-size))
 
-(defun vlf-revert (&optional _ignore-auto noconfirm)
-  "Revert current chunk.  Ignore _IGNORE-AUTO.
+(defun vlf-revert (&optional _auto noconfirm)
+  "Revert current chunk.  Ignore _AUTO.
 Ask for confirmation if NOCONFIRM is nil."
   (interactive)
   (when (or noconfirm



reply via email to

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