1
0
mirror of https://github.com/m00natic/vlfi.git synced 2025-01-18 20:10:47 +00:00

Retry decoding when the initial attempt seems wrong.

This commit is contained in:
Andrey Kotlarski 2014-01-27 01:16:00 +02:00
parent cc9b115486
commit 9510c70860

View File

@ -249,6 +249,15 @@ bytes added to the end."
(let ((coding-system-for-read coding))
(decode-coding-inserted-region position (point-max)
buffer-file-name nil start end)))
(when (eq (detect-coding-region position (min (+ position
vlf-sample-size)
(point-max)) t)
'no-conversion)
(delete-region position (point-max))
(insert-file-contents-literally buffer-file-name nil start end)
(let ((coding-system-for-read nil))
(decode-coding-inserted-region position (point-max)
buffer-file-name nil start end)))
(setq buffer-file-coding-system last-coding-system-used))
(defun vlf-adjust-start (start end position adjust-end)