branch: externals/vlf
commit c533bce9560532bcf0cfdae68aadaa3cd001f97c
Author: Andrey Kotlarski <[email protected]>
Commit: Andrey Kotlarski <[email protected]>
Add command to set batch size explicitly.
---
README.org | 6 +++---
vlf.el | 13 ++++++++++---
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/README.org b/README.org
index 1333d2a..e6af8ec 100644
--- a/README.org
+++ b/README.org
@@ -92,12 +92,12 @@ Here's example how to add another prefix (*C-x v*):
** Control batch size
+Use *M-x vlf-set-batch-size* to change batch size and update chunk
+immediately.
+
*C-c C-v +* and *C-c C-v -* control current batch size by factors
of 2.
-You can also set by hand local variable *vlf-batch-size* and then
-refresh with *C-c C-v g*.
-
** Move around
Scrolling automatically triggers moving to previous or next chunk at
diff --git a/vlf.el b/vlf.el
index 00d2cee..bb35ebb 100644
--- a/vlf.el
+++ b/vlf.el
@@ -53,6 +53,8 @@
"Toggle continuous chunk recenter around current point.")
(autoload 'vlf-stop-follow "vlf-follow"
"Stop continuous recenter.")
+(autoload 'vlf-ediff-buffers "vlf-ediff"
+ "Run batch by batch ediff over VLF buffers." t)
(defvar vlf-mode-map
(let ((map (make-sparse-keymap)))
@@ -71,6 +73,7 @@
(define-key map "]" 'vlf-end-of-file)
(define-key map "j" 'vlf-jump-to-chunk)
(define-key map "l" 'vlf-goto-line)
+ (define-key map "e" 'vlf-ediff-buffers)
(define-key map "f" 'vlf-toggle-follow)
(define-key map "g" 'vlf-revert)
map)
@@ -186,9 +189,13 @@ When prefix argument is negative
Normally, the value is doubled;
with the prefix argument DECREASE it is halved."
(interactive "P")
- (setq vlf-batch-size (if decrease
- (/ vlf-batch-size 2)
- (* vlf-batch-size 2)))
+ (vlf-set-batch-size (if decrease (/ vlf-batch-size 2)
+ (* vlf-batch-size 2))))
+
+(defun vlf-set-batch-size (size)
+ "Set batch to SIZE bytes and update chunk."
+ (interactive (list (read-number "Size in bytes: " vlf-batch-size)))
+ (setq vlf-batch-size size)
(vlf-move-to-batch vlf-start-pos))
(defun vlf-beginning-of-file ()