emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/vlf 9510c70 215/310: Retry decoding when the initial at


From: Stefan Monnier
Subject: [elpa] externals/vlf 9510c70 215/310: Retry decoding when the initial attempt seems wrong.
Date: Sat, 28 Nov 2020 00:33:18 -0500 (EST)

branch: externals/vlf
commit 9510c708608beb9b168f5944877501befb3362d1
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>

    Retry decoding when the initial attempt seems wrong.
---
 vlf-base.el | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/vlf-base.el b/vlf-base.el
index 761da5f..c3d64fe 100644
--- a/vlf-base.el
+++ b/vlf-base.el
@@ -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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]