From 35ede9403c3bb4297586cf7c4152ae649d8d4b0b Mon Sep 17 00:00:00 2001 From: Andrey Kotlarski Date: Sun, 7 Sep 2014 00:07:21 +0300 Subject: [PATCH] Restore batch size after save with adjustment. --- vlf-write.el | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/vlf-write.el b/vlf-write.el index f15799a..a29e1a9 100644 --- a/vlf-write.el +++ b/vlf-write.el @@ -64,19 +64,21 @@ If changing size of chunk, shift remaining file content." (pos (point)) (font-lock font-lock-mode)) (font-lock-mode 0) - (let ((time (float-time))) + (let ((batch-size vlf-batch-size) + (time (float-time))) (if (< 0 size-change) (vlf-file-shift-back size-change region-length) (vlf-file-shift-forward (- size-change) region-length)) - (message "Save took %f seconds" (- (float-time) time))) - (if font-lock (font-lock-mode 1)) - (vlf-move-to-chunk-2 vlf-start-pos - (if (< (- vlf-end-pos vlf-start-pos) - vlf-batch-size) - (+ vlf-start-pos vlf-batch-size) - vlf-end-pos)) - (vlf-update-buffer-name) - (goto-char pos))))) + (if font-lock (font-lock-mode 1)) + (setq vlf-batch-size batch-size) + (vlf-move-to-chunk-2 vlf-start-pos + (if (< (- vlf-end-pos vlf-start-pos) + vlf-batch-size) + (+ vlf-start-pos vlf-batch-size) + vlf-end-pos)) + (vlf-update-buffer-name) + (goto-char pos) + (message "Save took %f seconds" (- (float-time) time))))))) (if hexl (vlf-tune-hexlify))) (run-hook-with-args 'vlf-after-batch-functions 'write)) t)