unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Determining coding system for text files
@ 2011-10-27 19:31 sdn.gnuem
  0 siblings, 0 replies; only message in thread
From: sdn.gnuem @ 2011-10-27 19:31 UTC (permalink / raw)
  To: help-gnu-emacs

[First: I'm running GNU Emacs 23.2.1 (i386-mingw-nt6.1.17601), on

64-bit Windows 7 Professional SP2.]



I would like new buffers to default to utf-8 encoding, and I would

like indeterminate files (like text files, especially source code

files) also to use utf-8, unless the -*- line specifies a different

coding system.



Currently, when I create a new buffer that isn't associated with any

file, the coding system is set to 'iso-latin1-dos'. When I visit an

existing (text) file, its coding system is set to 'undecided-dos'.



I tried to change this by executing

    (prefer-coding-system 'utf-8)

After that, when I create a new file, the coding system in the new

buffer is set to 'utf-8'.  However, when I open an existing file,

emacs still sets its coding system to 'undecided-dos'.



Frustrated, I then tried

    (setq-default buffer-file-coding-system 'utf-8)

That didn't help; visiting existing source code files still came up

with a coding of 'undecided-dos'.



Digging further, it seems that this is controlled by the variable

file-coding-system-alist.  If a file name does not match any of the

patterns in that list, the function find-buffer-file-type-coding-system

(in dos-w32.el) is invoked to determine what coding system to use for

the file.



That function *always* returns 'undecided' for text files, or

'no-conversion' for files it determines are binary.  The only time it

uses the default value for buffer-file-coding-system is if the file

doesn't yet exist!



Am I reading this right?  There is no way to set a preferred coding

system for existing files under Windows?  'prefer-coding-system' only

works in *nix environments?  I have to either add every source and

text file name pattern to file-coding-system-alist, or manually change

the buffer coding every time I visit an existing file?



Thanks in advance,

-- Sue D. Nymme



----------
This message was sent from a MailNull anti-spam account.  You can get
your free account and take control over your email by visiting the
following URL.

   http://mailnull.com/



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-10-27 19:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-27 19:31 Determining coding system for text files sdn.gnuem

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).