Previous: , Up: Using Semantic   [Contents][Index]

2.10 Tag Decoration Mode

Semantic Tag Decoration mode “decorates” each tag based on certain arbitrary features of that tag. Decorations are specified using the variable semantic-decoration-styles.

Command: global-semantic-decoration-mode &optional arg

Toggle Semantic Tag Decoration mode in all Semantic-enabled buffers. With an optional argument arg, enable if arg is positive, and disable otherwise.

Variable: semantic-decoration-styles

The value of this variable is a list of decoration styles for Semantic Tag Decoration mode. Each element in this list should have the form (name . flag), where name is a style name (a symbol) and flag is non-nil if the style is enabled.

The following styles are available:


Place an overline in front of each long tag (excluding prototypes).


Highlight class members that are designated as private.


Highlight class members that are designated as protected.


Highlight class members that are includes. Clicking on the highlighted include statements opens a context menu for configuring Semantic includes.

To enable or disable specific decorations, use this function:

Command: semantic-toggle-decoration-style name &optional arg

Prompt for a decoration style, name, and turn it on or off. With prefix argument arg, turn on if positive, otherwise off. Return non-nil if the decoration style is enabled.

Face: semantic-tag-boundary-face

Face for long tags in the semantic-tag-boundary decoration style.

Face: semantic-decoration-on-private-members-face

Face for privately-scoped tags in the semantic-decoration-on-private-members decoration style.

Face: semantic-decoration-on-protected-members-face

Face for protected tags in the semantic-decoration-on-protected-members decoration style.

Face: semantic-decoration-on-includes

Face for includes that are not in some other state, in the semantic-decoration-on-includes decoration style.

Face: semantic-decoration-on-unknown-includes

Face for includes that cannot be found, in the semantic-decoration-on-includes decoration style.

Face: semantic-decoration-on-unparsed-includes

Face for includes that have not yet been parsed, in the semantic-decoration-on-includes decoration style.

2.10.1 Creating New Decoration Modes

You can create new types of decorations using the following function:

Function: define-semantic-decoration-style name doc &rest flags

Define a new decoration style with name. doc is a documentation string describing the decoration style name. It is appended to auto-generated doc strings. An optional list of flags can also be specified. Flags are: :enabled <value> - specify the default enabled value for name.

This defines two new overload functions respectively called NAME-p and NAME-highlight, for which you must provide a default implementation in respectively the functions NAME-p-default and NAME-highlight-default. Those functions are passed a tag. NAME-p must return non-nil to indicate that the tag should be decorated by NAME-highlight.

To put primary decorations on a tag NAME-highlight, use functions like semantic-set-tag-face, semantic-set-tag-intangible, etc., found in the semantic-decorate library.

To add other kind of decorations on a tag, NAME-highlight must use semantic-decorate-tag, and other functions of the semantic decoration api found in this library.

Previous: , Up: Using Semantic   [Contents][Index]