From 290c4ac88566e349aa25c44575b4fd5d5a935d9b Mon Sep 17 00:00:00 2001 From: Andrey Kotlarski Date: Fri, 13 Dec 2013 17:08:13 +0200 Subject: [PATCH] Fix save with adjustment. --- vlf.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vlf.el b/vlf.el index f0a5e18..73b133f 100644 --- a/vlf.el +++ b/vlf.el @@ -967,7 +967,6 @@ Save anyway? ")) buffer-file-truename) vlf-end-pos vlf-file-size) (vlf-update-buffer-name)) - (vlf-verify-size) (let* ((region-length (length (encode-coding-region (point-min) (point-max) buffer-file-coding-system t))) @@ -978,8 +977,8 @@ Save anyway? ")) (let ((pos (point))) (if (< 0 size-change) (vlf-file-shift-back size-change) - (vlf-file-shift-forward (- size-change))) - (vlf-verify-size) + (vlf-file-shift-forward (- size-change)) + (vlf-verify-size)) (vlf-move-to-chunk-2 vlf-start-pos (if (< (- vlf-end-pos vlf-start-pos) vlf-batch-size) @@ -1004,6 +1003,7 @@ Save anyway? ")) (progress-reporter-update reporter read-start-pos)) ;; pad end with space (erase-buffer) + (vlf-verify-size) (insert-char 32 size-change)) (write-region nil nil buffer-file-name (- vlf-file-size size-change) t) @@ -1013,6 +1013,7 @@ Save anyway? ")) "Read `vlf-batch-size' bytes from READ-POS and write them \ back at WRITE-POS. Return nil if EOF is reached, t otherwise." (erase-buffer) + (vlf-verify-size) (let ((read-end (+ read-pos vlf-batch-size))) (insert-file-contents-literally buffer-file-name nil read-pos @@ -1046,6 +1047,7 @@ Done by saving content up front and then writing previous batch." Then write initial buffer content to file at WRITE-POS. If HIDE-READ is non nil, temporarily hide literal read content. Return nil if EOF is reached, t otherwise." + (vlf-verify-size) (let ((read-more (< read-pos vlf-file-size)) (start-write-pos (point-min)) (end-write-pos (point-max)))