Lugaru's Epsilon
Programmer's
Editor

Context:
Epsilon User's Manual and Reference
   Commands by Topic
      . . .
      The Screen
         Display Commands
         Horizontal Scrolling
         Windows
         . . .
         The Bell
      Buffers and Files
         Buffers
         Files
         File Variables
            Directory-wide File Variables
            Vi/Vim File Variables
         Internet Support
         Unicode Features
         . . .
      Starting and Stopping Epsilon
         Session Files
         File Associations
         Sending Files to a Prior Instance
         MS-Windows Integration Features
      . . .

Previous   Up    Next
File Name Case  Commands by Topic   Directory-wide File Variables


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

File Variables

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".

These are specially-formatted lines at the top or bottom of a file that indicate the file should use a particular language mode or tab size. For example, you can put -*- mode: VBasic -*- anywhere on the first line of a file to force Epsilon to Visual Basic mode, or write -*- tab-size: 3 -*- to make Epsilon use that tab size setting.

Epsilon recognizes a syntax for file variables that's designed to be generally compatible with Emacs. The recognized formats are as follows. First, the first line of the file (or the second, if the first starts with #!, to accommodate the Unix "shebang" line) may contain text in one of these formats:

-*- mode: modename -*-

-*- modename -*-

-*- tab-width: number -*-

-*- mode: modename; tab-width: number -*-

Other characters may appear before or after each possibility above; typically there would be commenting characters, so a full line might read /* -*- mode: shell -*- */. The first two examples set that buffer to the specified mode name, such as Perl or VBasic or C, by running a command named modename-mode if one exists. (A mode name of "C++" makes Epsilon uses the C++ submode of C mode.) The third example sets the width of a tab character for that buffer.

In more detail, between the -*- sequences may be one or more definitions, separated by ; characters. Spacing and capitalization are ignored throughout. Each definition may either be a mode name alone, or a setting name followed by a colon : and a value.

The setting names recognized are "mode", as another way to specify the mode; "tab-size" or "tab-width" to set the buffer's tab size, or "margin-right" or "fill-column" to set the buffer's right margin. (The names tab-size and margin-right reflect the names of the Epsilon variables they set; the names "tab-width" and "fill-column" are more compatible with other programs, and recommended if non-Epsilon users may edit the files.)

Similarly, you can use either "auto-fill-mode" or "fill-mode" to set whether Epsilon should break lines as you type, and either "indent-with-tabs" or "indent-tabs-mode" to set whether indenting should use tab characters in addition to spaces. The latter name, in each case, is the more compatible one. Also, you can write "nil" instead of 0 to turn off a setting, again for compatibility.

Epsilon also recognizes "compile-command" for use with the compile-buffer command; see Compiling From Epsilon for details. And it recognizes "coding" to indicate the file's Unicode encoding, if the detect-encodings variable permits this.

It recognizes "write-line-translate" as a way to set the style of line translation for the file after it has been read in; this is useful as a directory-wide setting, to permit files to be auto-detected when read, but forced into a consistent format when written. The recognized value names for this setting are: "dos" (or equivalently "windows"), "binary", "unix", "mac", and "auto". See Line Translation for details.

Epsilon also recognizes all the other variable names listed in the table.

 auto-fill-indents  indents-separate-paragraphs
 auto-fill-mode  margin-right
 auto-indent  mode
 auto-read-changed-file  over-mode
 c-indent  perl-indent
 case-fold  soft-tab-size
 comment-column  sort-case-fold
 compile-command  tab-size
 concurrent-compile  tab-width
 delete-hacking-tabs  tex-force-latex
 fill-column  tex-paragraphs
 fill-mode  undo-size
 goal-column  vbasic-indent
 html-paragraph-is-container  virtual-space
 indent-tabs-mode  want-backups
 indent-with-tabs  want-warn

Another syntax for normal file variables only appears at the end of a file, starting within the last 3000 characters. It looks like this:

Local Variables:
mode: modename
tab-size: number
End:

The first and last lines are required; inside are the settings, one per line. Each line may have additional text at the start and end of each line (so it will look like a comment in the file's programming language). The "coding" file variable doesn't use this alternative syntax; any specified encoding must be on the first line only.

Bits in the variable use-file-variables enable scanning for file variables of different sorts.

Subtopics:

Directory-wide File Variables
Vi/Vim File Variables



Previous   Up    Next
File Name Case  Commands by Topic   Directory-wide File Variables


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