Previous: Terminal I/O Encoding, Up: Coding Systems
On MS-DOS and Microsoft Windows, Emacs guesses the appropriate end-of-line conversion for a file by looking at the file's name. This feature classifies files as text files and binary files. By “binary file” we mean a file of literal byte values that are not necessarily meant to be characters; Emacs does no end-of-line conversion and no character code conversion for them. On the other hand, the bytes in a text file are intended to represent characters; when you create a new file whose name implies that it is a text file, Emacs uses DOS end-of-line conversion.
This variable, automatically buffer-local in each buffer, records the file type of the buffer's visited file. When a buffer does not specify a coding system with
buffer-file-coding-system, this variable is used to determine which coding system to use when writing the contents of the buffer. It should benilfor text,tfor binary. If it ist, the coding system isno-conversion. Otherwise,undecided-dosis used.Normally this variable is set by visiting a file; it is set to
nilif the file was visited without any actual conversion.
This variable holds an alist for recognizing text and binary files. Each element has the form (regexp . type), where regexp is matched against the file name, and type may be
nilfor text,tfor binary, or a function to call to compute which. If it is a function, then it is called with a single argument (the file name) and should returntornil.When running on MS-DOS or MS-Windows, Emacs checks this alist to decide which coding system to use when reading a file. For a text file,
undecided-dosis used. For a binary file,no-conversionis used.If no element in this alist matches a given file name, then
default-buffer-file-typesays how to treat the file.
This variable says how to handle files for which
file-name-buffer-file-type-alistsays nothing about the type.If this variable is non-
nil, then these files are treated as binary: the coding systemno-conversionis used. Otherwise, nothing special is done for them—the coding system is deduced solely from the file contents, in the usual Emacs fashion.
