Lugaru's Epsilon
Programmer's
Editor 14.04

Context:
Epsilon User's Manual and Reference
   Commands by Topic
      Buffers and Files
         Buffers
         Files
            Reading Files
            Read-Only Files
            Saving Files
            Backup Files
            File Name Templates
            . . .
         File Variables
            Directory-wide File Variables
            Vi/Vim File Variables
         . . .

Previous   Up    Next
Read-Only Files  Commands by Topic   Backup Files


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

Saving Files

The Ctrl-x Ctrl-s key writes a buffer to the file name associated with the buffer. If the current buffer contains no file, the command asks you for a file name.

To write the buffer to some other file, use the Ctrl-x Ctrl-w key. The command prompts for a file name and writes the buffer to that file. Epsilon then associates that file name with the buffer, so later Ctrl-x Ctrl-s commands will write to the same file. If the file you specified already exists, Epsilon will ask you to confirm that you wish to overwrite it. To disable this warning, you can set the variable warn-before-overwrite to zero. (Setting the variable to zero also prevents several other commands from asking for confirmation before overwriting a file.) You can use the set-file-name command to set the buffer's file name without saving the file.

Before Epsilon saves a file, it checks the copy of the file on disk to see if anyone has modified it since you read it into Epsilon. This might happen if another user edited the file (perhaps over a network), or if a program running concurrently with Epsilon modified the file. Epsilon does this by comparing the file's date and time to the date and time Epsilon saved when it read the file in. If they don't match (within a tolerance determined by the file-date-tolerance variable), Epsilon displays a warning and asks you what you want to do. You can choose to read the disk version of the file and discard the one already in a buffer, replace the copy on disk with the copy you've edited, or compare the two versions.

Epsilon checks the file date of a file each time you switch to a buffer or window displaying that file, and before you read or write the file. When a file changes on disk and you haven't modified the copy in memory, Epsilon automatically reads the new version. (It doesn't do this automatically if the file on disk is very large, or substantially smaller than the copy in memory.) You can make Epsilon always ask before reading by setting the buffer-specific variable auto-read-changed-file to zero.

Set the buffer-specific variable want-warn to 0 if you don't want Epsilon to ever check the file date or warn you. Or under Windows, set the file-date-skip-drives variable to make Epsilon ignore file dates on specific types of drives, such as network drives or floppy disks. Epsilon never checks file dates for URLs.

You can have Epsilon remove any spaces or tabs at the end of each line, before saving a file. See the c-delete-trailing-spaces and default-delete-trailing-spaces variables.

Similarly, you can have Epsilon make sure files you save end with a line termination character like a newline by setting the default-add-final-newline variable. To get this behavior only for specific modes, create a variable with a name like html-add-final-newline and Epsilon will use its setting instead for buffers in that mode.

Epsilon automatically marks a buffer as "modified" when you change it, and shows this with a star "*" at the end of the buffer's mode line. When Epsilon writes a buffer to disk or reads a file into a buffer, it marks the buffer as "unmodified". When you try to exit Epsilon, it will issue a warning if any buffer contains a file with unsaved changes.

You may occasionally want to change a buffer's modified status. You can do this with the change-modified command. Each time you invoke this command, the modified status of the current buffer toggles, unless you invoke it with a numeric argument. A nonzero numeric argument sets the modified status; a numeric argument of zero clears the modified status.

The save-all-buffers command, bound to Ctrl-x s, goes to each buffer with unsaved changes (those marked modified), and if it contains a file, writes the buffer out to that file. See the save-all-without-asking variable to alter what Epsilon does when there's an error saving a file.

The write-region command on Ctrl-x w takes the text between point and mark, and writes it to the file whose name you provide.

Standard bindings:

  Ctrl-x Ctrl-s  save-file
 Ctrl-x Ctrl-w  write-file
 Alt-~   change-modified
 Ctrl-x s  save-all-buffers
 Ctrl-x w  write-region
   set-file-name
 



Previous   Up    Next
Read-Only Files  Commands by Topic   Backup Files


Lugaru Epsilon Programmer's Editor 14.04 manual. Copyright (C) 1984, 2021 by Lugaru Software Ltd. All rights reserved.