In article <[EMAIL PROTECTED]>, Eli Zaretskii <[EMAIL PROTECTED]> writes:
> > From: Kenichi Handa <[EMAIL PROTECTED]> > > CC: [email protected] > > Date: Wed, 16 Aug 2006 14:18:29 +0900 > > > > (let (coding-system) > > (switch-to-buffer (find-file-noselect "temp")) > > (setq coding-system buffer-file-coding-system) > > (erase-buffer) > > (let ((coding-system-for-read 'auto-save-coding)) > > (insert-file-contents "#temp#")) > > (set-buffer-file-coding-system coding-system)) > > > > So, if the correct encoding can be detected from "temp", > > Emacs wins. > I'm not sure I understand what did you mean by ``if the correct > encoding can be detected from "temp"''. Does it mean that only the > file name and perhaps its contents before the editing are used in the > usual way to determine or detect its EOL format? And also default-buffer-file-coding-system. In short, the same coding system decided for a buffer which visits "temp" in a normal way. > If so, then the > following scenario will lose: > C-x C-f temp RET > C-x RET f dos > ... edit the file's text ... > M-x do-auto-save RET > C-x C-c > If after this, you recover-file, and the original file "temp" had EOL > format other than -dos, then the recovered file will not have the -dos > EOL format. Am I missing something? No. But, there are several other cases that will lose some coding information in a recovered buffer. Ex: Provided that "temp" contains only ASCII chars. C-x C-f temp RET C-x RET f utf-8 ... insert non-ASCII chars ... M-x do-auto-save RET C-x C-c The buffer of the recovered file is not utf-8. To fix this kind of problem, we must store the information of buffer-file-coding-system in a saved file or in a separate file (e.g. #temp#.coding). Even in the EOL case, it's not enough to encode #temp# by the current buffer-file-coding-system because, in editing, you may delete all newlines in a buffer. --- Kenichi Handa [EMAIL PROTECTED] _______________________________________________ emacs-pretest-bug mailing list [email protected] http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
