Initial Commit
[packages] / xemacs-packages / semantic / doc / installation.texi
1 @ignore
2 @node Installation
3 @chapter Installation and Basic Configuration
4 @c This 'ignore' section fools texinfo-all-menus-update into creating
5 @c proper menus for this chapter.
6 @end ignore
7
8 Semantic should be installed as a part of the CEDET distribution.  See
9 the cedet/INSTALL file in the cedet distribution for basic
10 installation instructions.
11
12 @menu
13 * Canned Configuration::
14 * Search Optimization::
15 * Parsing Optimization::
16 @end menu
17
18 @node Canned Configuration
19 @section Canned Configuration
20
21 As described briefly in the cedet/INSTALL file, there are several
22 canned configurations you can use.  These configuration files just
23 turn different semantic modes on and off, but don't change intrinsic
24 semantic parsing behaviors.
25
26 @deffn Command semantic-load-enable-minimum-features
27 @anchor{semantic-load-enable-minimum-features}
28 Enable the minimum number of semantic features for basic usage.
29 This includes:
30 @table @asis
31 @item @dfn{semantic-idle-scheduler-mode}
32 Keeps a buffer's parse tree up to date.
33 (@pxref{(semantic-user)Idle Scheduler}.)
34 @item @code{semanticdb-minor-mode}
35 Stores tags when a buffer is not in memory.
36 (@pxref{(semantic-user)semanticdb}.)
37 @item @dfn{semanticdb-load-system-caches}
38 Loads any systemdbs created earlier.
39 (@pxref{(semantic-user)semanticdb}.)
40 @item @dfn{semanticdb-load-ebrowse-caches}
41 Loads any ebrowse dbs created earlier.
42 (@pxref{(semantic-user)Create System Databases}.)
43 @end table
44 @end deffn
45
46 @deffn Command semantic-load-enable-code-helpers
47 @anchor{semantic-load-enable-code-helpers}
48 Enable some semantic features that provide coding assistance.
49 This includes @dfn{semantic-load-enable-minimum-features} plus:
50 @table @dfn
51 @item imenu
52 Lists Semantic generated tags in the menubar.
53 @item semantic-idle-summary-mode
54 Show a summary for the tag indicated by
55 code under point.  (intellisense)
56 (@pxref{(semantic-user)Idle Summary Mode}.)
57 @item senator-minor-mode
58 Semantic Navigator, and global menu for all features semantic.
59 (@pxref{(semantic-user)senator}.)
60 @item semantic-mru-bookmark-mode
61 Provides a `switch-to-buffer' like keybinding for tag names.
62 (@pxref{(semantic-user)MRU Bookmarks Mode}.)
63 @end table
64 @end deffn
65
66 @deffn Command semantic-load-enable-gaudy-code-helpers
67 @anchor{semantic-load-enable-gaudy-code-helpers}
68 Enable semantic features that provide gaudy coding assistance.
69 This includes @dfn{semantic-load-enable-code-helpers}.
70 @table @dfn
71 @item semantic-stickyfunc-mode
72 Tracks current function in header-line (when available).
73 (@pxref{(semantic-user)Sticky Function Mode}.)
74 @item semantic-idle-completions-mode
75 Provide smart symbol completion automatically at idle time.
76 (@pxref{(semantic-user)Idle Completions Mode}.)
77 @item semantic-decoration-mode
78 Decorate tags based on various attributes.
79 (@pxref{(semantic-user)Tag Decoration Mode}.)
80 @end table
81
82 @obsolete{semantic-load-enable-guady-code-helpers,semantic-load-enable-gaudy-code-helpers}
83 @end deffn
84
85 @deffn Command semantic-load-enable-excessive-code-helpers
86 @anchor{semantic-load-enable-excessive-code-helpers}
87 Enable all semantic features that provide coding assistance.
88 This includes all features of @dfn{semantic-load-enable-code-helpers} plus:
89 @table @dfn
90 @item which-func-mode
91 Display the current function in the mode line.
92 @end table
93
94
95 @end deffn
96
97 @deffn Command semantic-load-enable-semantic-debugging-helpers
98 @anchor{semantic-load-enable-semantic-debugging-helpers}
99 Enable all semantic features that assist with debugging semantic.
100 These modes include:
101 @table @dfn
102 @item semantic-highlight-edits-mode
103 Highlight text that has been edited since the last parse step.
104 (@pxref{(semantic-user)Highlight Edits Mode}.)
105 @item semantic-show-unmatched-syntax-mode
106 Highlight lexical tokens which failed to be parsed.
107 (@pxref{(semantic-user)Unmatched Syntax Highlighting}.)
108 @item semantic-show-parser-state-mode
109 Show the current buffer state via small indicators in the mode line.
110 (@pxref{(semantic-user)Parser State}.)
111 @end table
112
113 @end deffn
114
115
116 @node Search Optimization
117 @section Search Optimization
118
119 A common use of semantic is for smart completion and tag browsing.
120 These operations involve searching through the tags of your files.
121 For complete documentation on configuring your searches,
122 @ref{(semantic-user)Semanticdb Search Configuration}.
123
124 The default configuration is for fast searches that may not find your
125 symbols all the time.
126
127 Searching is controlled with @code{semanticdb-find-default-throttle}.
128 To force the search to find and read and tag files not yet in memory,
129 you might add code like this for C mode.
130
131 @example
132 (setq-mode-local c-mode
133                  semanticdb-find-default-throttle
134                  '(project unloaded system recursive))
135 @end example
136
137 Finding unloaded databases requires knowing the search path.  You can
138 find headers on a system or project level search path.
139 @xref{(semantic-user)Include paths}.
140
141 If using the above tactic doesn't work for your language (something
142 other than C/C++), it may be that your language isn't configured
143 properly for finding include files.  You would need to refer to the
144 @ref{(semantic-langdev)} for details.
145
146 If you were to be working on a linux kernel, you might opt to
147 configure your search path in your @file{.emacs} file with code like
148 this:
149
150 @example
151 (semantic-reset-system-include 'c-mode)
152 (semantic-add-system-include "/usr/src/linux-2.4/include" 'c-mode)
153 @end example
154
155 It is also useful to find and install extra search engine back-ends,
156 such @xref{(semantic-user)Create System Databases}.  Ebrowse is one such back-end for
157 C and C++ code.
158
159 You might create an ebrowse database for your C include files like
160 this:
161
162 @example
163 M-x semanticdb-create-ebrowse-database RET /usr/include/ RET
164 @end example
165
166 This will create the database, save it, and add it to the database
167 search list for your C and C++ based projects.  These databases will
168 be created in your @file{~/.semanticdb} directory to be reloaded in
169 future Emacs sessions.
170
171
172 @node Parsing Optimization
173 @section Parsing Optimization
174
175 The semantic parsers generate the tags that form the basis of all the
176 semantic based tools, such as browsers and completion.  Keeping those
177 tags up to date can have performance implications.
178
179 Here are some common tasks you may be interested in:
180
181 @subsection Don't parse certain buffers
182
183 You can inhibit parsing using the @code{semantic-inhibit-functions}
184 variable. 
185
186 @defvar semantic-inhibit-functions
187 @anchor{semantic-inhibit-functions}
188 List of functions to call with no arguments before to setup Semantic.
189 If any of these functions returns non-@code{nil}, the current buffer is not
190 setup to use Semantic.
191 @end defvar
192
193 You could have this inihibit parsing in very large files, or files
194 which case particular problems to semantic.
195
196
197 @subsection Parsing in idle time
198
199 Tags are usually kept up to date when Emacs is idle
200 @ref{(semantic-user)Idle Scheduler}.  The semantic's idle-scheduler
201 automatically updates the tags in various buffers before executing
202 specific idle modes, such as summary mode.
203
204 You might choose to tune the scheduler with some code like this in
205 your @file{.emacs} file:
206
207 @example
208 ;; Increase the delay before activation
209 (setq semantic-idle-scheduler-idle-time 10)
210 ;; Don't reparse really big buffers.
211 (setq semantic-idle-scheduler-max-buffer-size 100000)
212 @end example
213
214