Lugaru's Epsilon Programmer's Editor
Context:
|
Epsilon User's Manual and Reference > Commands by Topic > Language Modes > C ModeThe c-mode command puts the current buffer in C mode. In C mode, the <Enter> key indents the next line appropriately for a program written in C, C++, Java, Epsilon's extension language EEL, or other C-like languages. It examines previous lines to find the correct indentation. It doesn't do a perfect job, but usually guesses correctly. Epsilon supports several common styles of indentation, controlled by some extension language variables.The Closeback variable controls the position of the closing brace:
Closeback = 0;
By placing the opening brace on the following line, you may also use these styles:
Closeback = 0;
Closeback by default has a value of 1. Use the Topindent variable to control the indentation of top-level statements in a function:
Topindent = 0;
Topindent by default has a value of 1.
The Matchdelim variable controls whether typing ), ], or
In C mode, the <Tab> key reindents the current line if pressed with point in the current line's indentation. <Tab> just inserts a tab if pressed with point somewhere else, or if pressed two or more times successively. If you set the variable c-tab-always-indents to 1, then the <Tab> key will reindent the current line, regardless of your position on the line. If you press it again, it will insert another tab. When you yank text into a buffer in C mode, Epsilon automatically reindents it. This is similar to the "smart paste" feature in some other editors. You can set the variable reindent-after-c-yank to zero to disable this behavior. Epsilon doesn't normally reindent comments when yanking; set the reindent-c-comments and reindent-one-line-c-comments variables to change that.
By default, Epsilon uses the value of the buffer-specific
tab-size variable to determine how far to indent. For
example, if the tab size has a value of 5, Epsilon will indent the
line following an If you want the width of a tab character in C mode buffers to be different than in other buffers, set the variable c-tab-override to the desired value. C mode will change the buffer's tab size to the specified number of columns. The eel-tab-override variable does the same in EEL buffers (which use a variation of C mode). Also see the description of file variables in File Variables for a way in which individual files can indicate they should use a particular tab size. If you want to use one value for the tab size and a different one for C indentation, set the buffer-specific c-indent variable to the desired indentation using the set-variable command. When c-indent has a value of zero, as it has by default, Epsilon uses the tab-size variable for its indentation. (Actually, the <Tab> key in C mode doesn't necessarily insert a tab when you press it two or more times in succession. Instead, it indents according to c-indent. If the tab size differs from the C indent, it may have to insert spaces to reach the proper column.)
The c-case-offset variable controls the indentation of
Similarly, the c-access-spec-offset variable controls the
indentation of The c-label-indent variable provides the indentation of lines starting with labels. Normally, Epsilon moves labels to the left margin. Epsilon offsets the indentation of a left brace on its own line by the value of the variable c-brace-offset. For example, with a tab size of eight and default settings for other variables, a c-brace-offset of 2 produces:
By default, the C indenter tries to align continuation lines under
parentheses and other syntactic items on prior lines. If Epsilon
can't find anything on prior lines to align under, it indents
continuation lines two levels more than the original line. (With
default settings, Epsilon indents unalignable continuation lines 8
positions to the right of the original line.) Epsilon adds the value
of the variable c-contin-offset to this indentation, though.
If you want Epsilon to indent unalignable continuation lines ten
columns less, set c-contin-offset to
If aligning the continuation line would make it start in a column
greater than the value of the variable c-align-contin-lines
(default As a special case, setting the c-align-contin-lines to zero makes Epsilon never try to align continuation lines under syntactic features on prior lines. Epsilon will then indent all continuation lines by one level more than the original line (one extra tab, normally), plus the value of the variable c-contin-offset. If the continuation line contains only a left parenthesis character (ignoring comments), Epsilon can align it with the start of the current statement if you set c-align-open-paren nonzero. If the variable is zero, it's aligned like other continuation lines.
|