Lugaru's Epsilon
Programmer's
Editor

Context:
Epsilon User's Manual and Reference
   Commands by Topic
      Buffers and Files
         Buffers
         Files
            . . .
            Saving Files
            Backup Files
            Line Translation
            DOS/OEM Character Set Support
            File Name Prompts
            . . .
         Internet Support
            URL Syntax
         . . .

Previous   Up    Next
Backup Files  Commands by Topic   DOS/OEM Character Set Support


Epsilon User's Manual and Reference > Commands by Topic > Buffers and Files > Files >

Line Translation

Most Windows, DOS and OS/2 programs use files with lines separated by the pair of characters Return, Newline (or Control-M, Control-J). But internally Epsilon separates lines with just the newline character, Ctrl-J. Epsilon normally translates between the two systems automatically when reading or writing text files in this format. When it reads a file, it removes all Ctrl-M characters, and when it writes a file, it adds a Ctrl-M character before each Ctrl-J.

Epsilon will automatically select one of several other translation types when appropriate, based on the contents of the file you edit. It automatically determines whether you're editing a regular file, a binary file, a Unix file, or a Mac file, and uses the proper translation scheme. You can explicitly override this if necessary. Epsilon determines the file type by looking at the first few thousand bytes of the file, and applying heuristics. This is quite reliable in practice. However, Epsilon may occasionally guess incorrectly. You can tell Epsilon exactly which translation scheme to use by providing a numeric argument to a file reading command like find-file. Epsilon will then prompt for which translation scheme to use.

The set-line-translate command sets this behavior for the current buffer. It prompts for the desired type of translation, and makes future file reads and writes use that translation. Epsilon will display "Binary", "Unix", "DOS", or "Mac" in the mode line to indicate any special translation in effect. (It omits this when the "usual" translation is in effect: Unix files in Epsilon for Unix, DOS files in other versions.)

Set the default-translation-type variable if you want to force Epsilon to always use a particular type of translation when reading existing files, rather than examining their contents and choosing a suitable type. Set the new-buffer-translation-type variable if you want Epsilon to create new buffers and files with a translation type other than the default. For file names that start with ftp://, the ftp-ascii-transfers variable can changes the meaning of some translation types; see its online help.

Epsilon remembers the type of translation you want in each buffer using the buffer-specific variable translation-type.

Epsilon applies the following heuristics, in order, to determine a file's type. These may change in future versions.

A file that contains null bytes is considered binary. A file that has no Ctrl-M Ctrl-J pairs is considered a Unix file if it contains Ctrl-J characters, or a Macintosh file if it contains Ctrl-M. A file containing a Ctrl-M character not followed by either Ctrl-M or Ctrl-J is considered binary. Any other files, or files of less than five characters, are considered to be in standard DOS format (in Epsilon for Unix, Unix format).

Bear in mind that Epsilon makes all these decisions after examining only the first few thousand bytes of a file, and phrases like "contains null bytes" really mean "contains null bytes in its first few thousand characters."

Standard bindings:

    set-line-translate
 



Previous   Up    Next
Backup Files  Commands by Topic   DOS/OEM Character Set Support


Lugaru Copyright (C) 1984, 2020 by Lugaru Software Ltd. All rights reserved.