Recent Changes - Search:

Ted /




Ted implements a generalized, syntax independent auto-indentation, based solely on curly brace matching. Specifically, formatting is restricted to managing leading spaces in lines based only upon the '{' and '}' braces at the start and end of lines respectively. A line ending in an open brace increases indent levels, and a line containing just closing braces decreases indent levels.

Two special cases are of note:

  • A line where the first char is a hash "#" is never indented.
  • And a line ending in a backslash when the next line starts with an open-brace indicates a block that is to be untouched.

This indent strategy is general enough to handle most well-formed code and data for both Tcl and C.


Ted presumes the use of a certain coding conventions regarding the use of curley braces. These affect input when Preferences/Indent-Auto is enabled.

Final opening brace should always be at EOL.

    if {$i} {;  # BAD

It's ok to start and terminate braces on same line.

    if {$i} { set i 99; incr i  }

Multiple open braces fine, as long as close does to.

  if {$i} { while {$i} {
     # This is ok.

Multi-line statements don't indent until open-brace is seen.

  if {$somevar > $othervar &&
  $somevar > 0 } {
       incr i

One exception: use of typed proc definition.

    proc {i} { #TYPES: . int


Ted does not normally use Tab characters: All indentation is performed with spaces. The exception are with Makefiles, which require Tabs.

Edit - History - Print - Recent Changes - Search
Page last modified on June 06, 2009, at 03:45 PM