[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to overwrite completely a buffer with a file, with overwriting a
From: |
Eli Zaretskii |
Subject: |
Re: How to overwrite completely a buffer with a file, with overwriting also the coding system ? |
Date: |
Sat, 09 May 2009 10:01:15 +0300 |
> From: =?iso-8859-1?Q?Vincent_Bela=EFche?= <address@hidden>
> Date: Fri, 8 May 2009 23:07:44 +0200
>
> When I create a new target-file from a template, emacs-template creates a
> buffer for this target-file, which therefore is created with the default
> coding-system (iso-latin-1-dos for my machine), and then emacs-template
> insert into this buffer the content of the template file. Now I want that the
> file be created with iso-latin-1-unix coding. Even though the template file
> contains a -*- coding: iso-latin-1-unix -*- the target file is created with
> dos end-of-lines.
What Emacs version is this? I think Emacs 23 will ask the user for
confirmation if the `coding:' cookie disagrees with the buffer's
encoding.
In any case, if you call the `find-auto-coding' function right after
inserting the template, this function will tell you what encoding
should the buffer use, taking into account the file's name and the
`coding:' cookie. You can then set the right encoding by calling
`set-buffer-file-coding-system'.