Joined: 08 Mar 2006 |
Posts: 63 |
|
|
|
Posted: Thu Aug 17, 2006 8:46 am |
|
|
|
|
|
It would be great if PHPEd could recognize file variables in Emacs and/or Vim format. File variables are specially formatted comments that can set mode, tab size and other editor settings. It would make it easier to work with various open source projects if this feature was implemented.
(The below text is snipped from the help text of Epsilon, another programming editor)
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; coding: encoding name -*-
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.
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.
|
|