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.
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.
13 * Canned Configuration::
14 * Search Optimization::
15 * Parsing Optimization::
18 @node Canned Configuration
19 @section Canned Configuration
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.
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.
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}.)
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:
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}.)
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}.
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}.)
82 @obsolete{semantic-load-enable-guady-code-helpers,semantic-load-enable-gaudy-code-helpers}
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:
91 Display the current function in the mode line.
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.
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}.)
116 @node Search Optimization
117 @section Search Optimization
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}.
124 The default configuration is for fast searches that may not find your
125 symbols all the time.
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.
132 (setq-mode-local c-mode
133 semanticdb-find-default-throttle
134 '(project unloaded system recursive))
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}.
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.
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
151 (semantic-reset-system-include 'c-mode)
152 (semantic-add-system-include "/usr/src/linux-2.4/include" 'c-mode)
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
159 You might create an ebrowse database for your C include files like
163 M-x semanticdb-create-ebrowse-database RET /usr/include/ RET
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.
172 @node Parsing Optimization
173 @section Parsing Optimization
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.
179 Here are some common tasks you may be interested in:
181 @subsection Don't parse certain buffers
183 You can inhibit parsing using the @code{semantic-inhibit-functions}
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.
193 You could have this inihibit parsing in very large files, or files
194 which case particular problems to semantic.
197 @subsection Parsing in idle time
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.
204 You might choose to tune the scheduler with some code like this in
205 your @file{.emacs} file:
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)