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

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

[elpa] master 2f00e0a 3/5: Avoid write-file side-effects, fixed encoding


From: Ingo Lohmar
Subject: [elpa] master 2f00e0a 3/5: Avoid write-file side-effects, fixed encoding
Date: Thu, 23 Feb 2017 13:29:57 -0500 (EST)

branch: master
commit 2f00e0a6ab233a894c2da2a8786b311acc5f2aae
Author: Ingo Lohmar <address@hidden>
Commit: Ingo Lohmar <address@hidden>

    Avoid write-file side-effects, fixed encoding
---
 company-statistics.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/company-statistics.el b/company-statistics.el
index 668f88c..a7dd961 100644
--- a/company-statistics.el
+++ b/company-statistics.el
@@ -141,15 +141,18 @@ number)."
 (defun company-statistics--save ()
   "Save statistics."
   (with-temp-buffer
+    (set-buffer-multibyte nil)
     (let (print-level print-length)
-      (insert
+      (encode-coding-string
        (format
         "%S"
         `(setq
           company-statistics--scores ,company-statistics--scores
           company-statistics--log ,company-statistics--log
-          company-statistics--index ,company-statistics--index))))
-    (write-file company-statistics-file)))
+          company-statistics--index ,company-statistics--index))
+       'utf-8 nil (current-buffer))
+      (let ((coding-system-for-write 'binary))
+        (write-region nil nil company-statistics-file)))))
 
 (defun company-statistics--maybe-save ()
   (when (and (company-statistics--initialized-p)



reply via email to

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