1
0
mirror of https://github.com/m00natic/vlfi.git synced 2025-01-18 12:05:31 +00:00

Fix save with adjustment.

This commit is contained in:
Andrey Kotlarski 2013-12-13 17:08:13 +02:00
parent db1da304d5
commit 290c4ac885

8
vlf.el
View File

@ -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)))