Subject: Re: bug#15535: Acknowledgement (24.3.50; basic-save-buffer should update buffer-file-coding-system value if the contents were written using different coding system)

From: Dmitry Gutov <[email-masked]>
Date: Sun, 06 Oct 2013 02:09:01 +0300

Sorry, here's a better test:

(ert-deftest save-buffer-updates-buffer-file-coding-system ()
   (let ((file (expand-file-name "foo" temporary-file-directory))
         (default-buffer-file-coding-system 'utf-8-unix))
     (find-file file)
     (insert "abcdef\n")
     (save-buffer)
     (kill-buffer)
     (unwind-protect
         (with-current-buffer (find-file-noselect file)
           (should (eq 'undecided (coding-system-change-eol-conversion
                                   buffer-file-coding-system nil)))
           (insert "водка матрёшка селёдка")
           (save-buffer)
           (let ((coding-system buffer-file-coding-system))
             (kill-buffer)
             (should (eq 'utf-8-unix coding-system))))
       (delete-file file))))

Likewise, succeeds on 24.3, fails on trunk.