Initial Commit
[packages] / xemacs-packages / semantic / doc / minor-modes.texi
1 @ignore
2 @node Semantic Minor Modes
3 @chapter Semantic Minor Modes
4 @end ignore
5
6 Semantic comes with a wide range of minor-modes which use various
7 features of semantic.  These modes vary widly in utility.
8
9 There are some core modes that are required for smooth operations.
10 Some of these are discussed in other chapters, such as @ref{Idle
11 Scheduler}, and @ref{semanticdb}
12
13 @menu
14 * Code Helpers::        Modes for assisting in authoring code.
15 * Development Modes::   Modes for assisting in developing/debugging Semantic.
16 @end menu
17
18 @node Code Helpers, Development Modes, Minor Modes, Minor Modes
19 @section Code Helpers
20
21 Code Helpers are minor modes that augment basic Emacs behavior in ways
22 that can assist in programming Semantic supported langauges.
23
24 @menu
25 * Sticky Function Mode::
26 * Tag Decoration Mode::
27 * MRU Bookmarks Mode::
28 @end menu
29
30 Senator is another mode which can assist in programming @ref{senator}.
31
32 @node Development Modes,  , Code Helpers, Minor Modes
33 @section Development Modes
34
35 @menu
36 * Highlight Edits Mode::
37 * Parser State::
38 * Unmatched Syntax Highlighting::
39 @end menu
40
41 @node Sticky Function Mode, Tag Decoration Mode, Code Helpers, Code Helpers
42 @subsection Sticky Function Headers
43
44 @deffn Command semantic-stickyfunc-mode &optional arg
45 Minor mode to show the title of a tag in the header line.
46 Enables/disables making the header line of functions sticky.
47 A function (or other tag class specified by
48 @code{semantic-stickyfunc-sticky-classes}) has a header line, meaning the
49 first line which describes the rest of the construct.  This first
50 line is what is displayed in the Emacs @var{21} header line.
51
52 With prefix argument @var{ARG}, turn on if positive, otherwise off.  The
53 minor mode can be turned on only if semantic feature is available and
54 the current buffer was set up for parsing.  Return non-@code{nil} if the
55 minor mode is enabled.
56 @end deffn
57
58 @defvar semantic-stickyfunc-sticky-classes
59 List of tag classes which sticky func will display in the header line.
60 @end defvar
61
62 @node Tag Decoration Mode, MRU Bookmarks Mode, Sticky Function Mode, Code Helpers
63 @subsection Tag Decoration Mode
64 @cindex semantic-decoration-mode
65
66 Decoration mode is a harness that allows any parsed tag to be
67 highlighted based on some arbitrary feature of that tag.  Decoration
68 mode is actually a full harness for providing any kind of decoration
69 on a tag based on a prefix function.
70
71 @deffn Command semantic-decoration-mode &optional arg
72 @anchor{semantic-decoration-mode}
73 Minor mode for decorating tags.
74 Decorations are specified in @code{semantic-decoration-styles}.
75 You can define new decoration styles with
76 @dfn{define-semantic-decoration-style}.
77 With prefix argument @var{arg}, turn on if positive, otherwise off.  The
78 minor mode can be turned on only if semantic feature is available and
79 the current buffer was set up for parsing.  Return non-@code{nil} if the
80 minor mode is enabled.
81 @end deffn
82
83 To enable or disable specific decorations, you can use this function:
84
85 @deffn Command semantic-toggle-decoration-style name &optional arg
86 @anchor{semantic-toggle-decoration-style}
87 Turn on/off the decoration style with @var{name}.
88 Decorations are specified in @code{semantic-decoration-styles}.
89 With prefix argument @var{arg}, turn on if positive, otherwise off.
90 Return non-@code{nil} if the decoration style is enabled.
91 @end deffn
92
93 You can create new types of decorations using the following function:
94
95 @defun define-semantic-decoration-style name doc &rest flags
96 @anchor{define-semantic-decoration-style}
97 Define a new decoration style with @var{name}.
98 @var{doc} is a documentation string describing the decoration style @var{name}.
99 It is appended to auto-generated doc strings.
100 An Optional list of @var{flags} can also be specified.  Flags are:
101   @code{:enabled} <value>  - specify the default enabled value for @var{name}.
102
103
104 This defines two new overload functions respectively called @code{NAME-p}
105 and @code{NAME-highlight}, for which you must provide a default
106 implementation in respectively the functions @code{NAME-p-default} and
107 @code{NAME-highlight-default}.  Those functions are passed a tag.  @code{NAME-p}
108 must return non-@code{nil} to indicate that the tag should be decorated by
109 @code{NAME-highlight}.
110
111 To put primary decorations on a tag @code{NAME-highlight} must use
112 functions like @dfn{semantic-set-tag-face}, @dfn{semantic-set-tag-intangible},
113 etc., found in the semantic-decorate library.
114
115 To add other kind of decorations on a tag, @code{NAME-highlight} must use
116 @dfn{semantic-decorate-tag}, and other functions of the semantic
117 decoration @var{api} found in this library.
118 @end defun
119
120 @node MRU Bookmarks Mode,  , Tag Decoration Mode, Code Helpers
121 @subsection MRU Bookmarks Mode
122 @cindex semantic-mru-bookmark-mode
123
124 MRU stands for Most Recently Used.  Semantic MRU Bookmarks track the
125 tags you edit and maintain a ring of things you've been working on.
126 You can then switch back to tags you've worked on recently by name.
127
128 @deffn Command semantic-mru-bookmark-mode &optional arg
129 @anchor{semantic-mru-bookmark-mode}
130 Minor mode for tracking tag-based bookmarks automatically.
131 Tag based bookmarks a tracked based on editing and viewing habits
132 and can then be navigated via the @var{mru} bookmark keymap.
133
134 With prefix argument @var{arg}, turn on if positive, otherwise off.  The
135 minor mode can be turned on only if semantic feature is available and
136 the current buffer was set up for parsing.  Return non-@code{nil} if the
137 minor mode is enabled.
138 @end deffn
139
140 Once this mode is enbled, any edit, or mark setting will add the
141 current tag to your MRU bookmark ring.
142
143 @table @kbd
144 @item C-x B
145 This keysequence is like @code{switch-to-buffer}, but uses a capital
146 @kbd{B} instead of lower case.  This lets you type in a tag name, or
147 use @kbd{M-p} and @kbd{M-n} to cycle through the bookmark list in
148 MRU order.
149 @end table
150
151
152
153 @node Highlight Edits Mode, Parser State, Development Modes, Development Modes
154 @subsection Highlight Edits Mode
155
156 Highlight edits mode is useful mostly for debugging the incremental
157 parser.  As you change text, that effected text is highlighted, and
158 you can visual predict what actions the incremental parser will need
159 to make.
160
161 @deffn Command semantic-highlight-edits-mode &optional arg
162 Minor mode for highlighting changes made in a buffer.
163 Changes are tracked by semantic so that the incremental parser can work
164 properly.
165 With prefix argument @var{ARG}, turn on if positive, otherwise off.  The
166 minor mode can be turned on only if semantic feature is available and
167 the current buffer was set up for parsing.  Return non-@code{nil} if the
168 minor mode is enabled.
169 @end deffn
170
171 @deffn Face semantic-highlight-edits-face
172 Face used to show dirty tokens in @code{semantic-highlight-edits-mode}.
173 @end deffn
174
175 @node Parser State, Unmatched Syntax Highlighting, Highlight Edits Mode, Development Modes
176 @subsection Parser State
177
178 @deffn Command semantic-show-parser-state-mode &optional arg
179 Minor mode for displaying parser cache state in the modeline.
180 The cache can be in one of three states.  They are
181 Up to date, Partial reprase needed, and Full reparse needed.
182 The state is indicated in the modeline with the following characters:
183 @table @code
184 @item -
185 The cache is up to date.
186 @item !
187 The cache requires a full update.
188 @item ~
189 The cache needs to be incrementally parsed.
190 @item %
191 The buffer is not lexically parseable.
192 @item @@
193 Auto-parse in progress (not set here.)
194 @end table
195 With prefix argument @var{ARG}, turn on if positive, otherwise off.  The
196 minor mode can be turned on only if semantic feature is available and
197 the current buffer was set up for parsing.  Return non-@code{nil} if the
198 minor mode is enabled.
199 @end deffn
200
201 @node Unmatched Syntax Highlighting,  , Parser State, Development Modes
202 @subsection Unmatched Syntax Highlighting
203
204 @deffn Command semantic-show-unmatched-syntax-mode &optional arg
205 Minor mode to highlight unmatched syntax tokens.
206 When a parser executes, some elements in the buffer may not match any
207 parser rules.  These text characters are considered unmatched syntax.
208 Often time, the display of unmatched syntax can expose coding
209 problems before the compiler is run.
210
211 With prefix argument @var{ARG}, turn on if positive, otherwise off.  The
212 minor mode can be turned on only if semantic feature is available and
213 the current buffer was set up for parsing.  Return non-@code{nil} if the
214 minor mode is enabled.
215
216 @kbd{C-c , `}           @dfn{semantic-show-unmatched-syntax-next}
217 @end deffn
218
219 @deffn Option semantic-unmatched-syntax-face
220 Face used to show unmatched-syntax in.
221 The face is used in  @dfn{semantic-show-unmatched-syntax-mode}.
222 @end deffn
223