Lugaru's Epsilon
Programmer's
Editor

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

Previous   Up    Next
Buffers  Commands by Topic   Read-Only Files


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

Reading Files

The Ctrl-X Ctrl-F key runs the find-file command. It prompts you for a file name. First, it scans the current buffers to see if any of them contain that file. If so, the command connects that buffer to the current window. Otherwise, the command creates a buffer with the same name as the file, possibly modified to make it different from the names of existing non-empty buffers, then reads the file into that buffer. Most people consider find-file the command they typically use to edit a new file, or to return to a file read in previously.

Normally Epsilon examines the file's contents to determine if it's a binary file, or in Unix or Macintosh format. If you prefix a numeric argument to find-file, Epsilon asks you for the correct format, as described in Line Translation, and for the name of an encoding. (Use the auto-detect encoding if you only want to force binary, Unix, Macintosh, or Windows format.)

The find-file command examines a file's name and contents to determine an appropriate language mode for it. For instance, files with a .c extension are put in C mode. You can override this decision with a "file variable". See File Variables. You can use the reset-mode command at any time to make Epsilon repeat that process, setting the buffer to a different mode if appropriate. It can be handy after you've temporarily switched to a different mode for any reason, or after you've started creating a new file with no extension and have now typed the first few lines, enough for Epsilon to auto-detect the proper mode.

If you type <Enter> without typing any file name when find-file asks for a file, it runs dired on the current directory. If you give find-file a file name with wild card characters, or a directory name, it runs the dired command giving it that pattern. See Directory Editing for a description of the very useful dired command. Also see File Name Prompts for information on related topics like how to type a file name with <Space> characters, customize the way Epsilon prompts for files, and so forth.

By default, at most prompts for file names like find-file's, Epsilon types in for you the directory portion of the current file. For example, suppose the current buffer contains a file named "\src\new\ll.c". If you invoke find-file , Epsilon will type in "\src\new\" for you. This comes in handy when you want to read another file in the same directory as the current file. You can simply begin typing another file name if you want Epsilon to ignore the pre-typed directory name. As soon as Epsilon notices you're typing an absolute file pathname, it will erase the pre-typed directory name. See File Name Prompts for details.

You can change the current directory with the cd command on F7. It prompts for a new current directory, and then displays the full pathname of the selected current directory. You can type the name of a new directory, or just type <Enter> to stay in the current directory. When you supply a file name, Epsilon interprets it with respect to the current directory unless it begins with a slash or backslash. If you specify a drive as part of the directory name, Epsilon will set the current drive to the indicated drive, then switch to the indicated directory. Press Alt-E when prompted for a directory name, and Epsilon will insert the name of the directory containing the current file. (If you start a concurrent process, Epsilon can link its current directory to Epsilon's; see the use-process-current-directory variable for details.)

The insert-file command on Ctrl-X I prompts for the name of a file and inserts it before point. It sets the mark before the inserted text, so you can kill it with Ctrl-W. (Also see the insert-file-remembers-file variable.)

The find-linked-file command on Ctrl-X Ctrl-L looks for a file name in the current buffer, then finds that file. It works with plain text files, and also understands #include in C-like buffers, <a href=> in HTML-like buffers, and various other mode-specific conventions. You can highlight a file name first whenever its automatic parsing of file names isn't right. In a process buffer, it looks for error messages, not file names (unless you've first highlighted a file name), and sets the current error message (as used by next-error) to the current line.

Epsilon uses a built-in list of directories to search for #include files; you can set the include-directories variable to add to that list. (The copy-include-file-name command also uses this list of directories.) For files with a .lst extension, it assumes the current line holds a file name, instead of searching for a pattern that matches a typical file name. This is one way to more easily manage files in a project that are in many different directories.

The key Ctrl-X Ctrl-V runs the visit-file command. It prompts you for a file name. If the file exists, the command reads it into the current buffer, and positions point at the beginning. The command discards the old contents of the buffer, but asks before discarding an unsaved buffer. If no file with the given name exists, the command clears the current buffer. If you prefix this command with a numeric argument, the command discards the old buffer content without warning. So if you want to revert to the copy of the file on disk, disregarding the changes you've made since you last saved the buffer, press Ctrl-U Ctrl-X Ctrl-V, followed by <Enter>. Most people use this command only to explicitly manipulate the file associated with a particular buffer. To read in a file, use the find-file command, described above.

The revert-file command rereads the current file from disk. If you've made any unsaved changes, it prompts first.

If a file has an extension .gz or .bz2, indicating a compressed file, Epsilon automatically decompresses it when you read it. See the uncompress-files variable.

Standard bindings:

  Ctrl-X Ctrl-F  find-file
 F7  cd
 Ctrl-X I  insert-file
 Ctrl-X Ctrl-V  visit-file
   revert-file
 



Previous   Up    Next
Buffers  Commands by Topic   Read-Only Files


Lugaru Copyright (C) 1984, 2012 Lugaru Software Ltd. All Rights Reserved.