text-edit-indentation

Function

Package: common-graphics

Arguments: symbol

Returns (or sets with setf) a list of integers that specifies how a source code form whose first element is symbol will be indented in the IDE editor if the form is wrapped to multiple lines. Each integer in the list specifies the number of spaces to the right of the form's opening parenthesis by which a corresponding element of the source code form will be indented if it begins a line of source code. The first integer corresponds to the second element of the source code form (typically the first argument to a function), the second integer corresponds to the third element of the form, and so on. The last integer in the list is also used for all leftover elements of the form when the form is longer than one plus the length of the integer list.

For example,

(text-edit-indentation 'defclass) 

returns the list

(4 4 2)

That indicates that the name of the class and the list of superclasses will each be indented by four spaces when they occur at the beginning of a line, and the rest of the defclass form will be indented by two spaces.

text-edit-indentation returns nil when no indentation has been specified for a symbol, and the IDE editor uses a default indentation for forms beginning with that symbol. If a newline exists after the first element of a form (or if the first element of the form is not a symbol), then the default indentation is one space. Otherwise successive lines are aligned to the right of the form's initial symbol.

This facility is not nearly as powerful as it might be. For example, there is no way to make a defmethod form indent its parameter list by a certain amount regardless of whether the form contains a qualifier (such as :after) before the parameter list. So this feature may be enhanced in the future, and enhancement may be incompatible. For now, certain definers such if* and loop have hardcoded indentation styles since this general specification is not adequate.

text-edit-indentation specifications are provided for many symbols, but users may want to add specifications for additional symbols, especially their own. This may be useful for function or macro names whose first one or two arguments are special in some way and indenting these arguments differently may clarify their special status. It may also be useful for reducing overall indentation when some arguments are placed on the same line as a defining symbol, since the default is to align successive lines at the far right of the defining symbol.

Common Graphics and IDE documentation is described in About Common Graphics and IDE documentation in cgide.htm.

The documentation is described in introduction.htm and the index is in index.htm.

Copyright (c) 1998-2000, Franz Inc. Berkeley, CA., USA. All rights reserved.

Created 2000.10.5.