* net/tramp-sh.el (tramp-sh-handle-set-file-acl): Add argument to
[bpt/emacs.git] / doc / misc / sem-user.texi
CommitLineData
a1d25d02 1@c This is part of the Semantic manual.
775b55af 2@c Copyright (C) 1999-2005, 2007, 2009-2012 Free Software Foundation, Inc.
a1d25d02 3@c See file semantic.texi for copying conditions.
3149927d
CY
4
5You can begin using @semantic{} by enabling Semantic mode, a global
8e687433
CY
6minor mode: type @kbd{M-x semantic-mode}, or open the @samp{Tools}
7menu and click on the menu item named @samp{Source Code Parsers
8(Semantic)}. @xref{Semantic mode}.
3149927d
CY
9
10When Semantic mode is turned on, Emacs automatically parses each file
8e687433
CY
11you visit. You can then use @semantic{} user commands in those
12buffers (@pxref{Semantic mode user commands}). You can also choose to
13enable a number of ``helper'' minor modes for saving tags, displaying
14tag information, and so forth.
3149927d
CY
15
16To enable Semantic mode each time you start Emacs, add the line
17@code{(semantic-mode 1)} to your initialization file. @xref{Init
18File,,,emacs,Emacs manual}.
19
20@menu
8e687433
CY
21* Semantic mode:: Global minor mode for @semantic{}.
22* SemanticDB:: Caching parsed buffers between sessions.
23* Idle Scheduler:: @semantic{} actions that occur when idle.
24* Analyzer:: Semantic tools for analyzing code.
25* Speedbar:: Using @semantic{} with the Speedbar.
26* SymRef:: Interface to symbol reference tools.
775b55af 27* MRU Bookmarks:: Managing tag "bookmarks".
8e687433
CY
28* Sticky Func Mode:: Showing declarations in the header line.
29* Highlight Func Mode:: Highlight the current function declaration.
30* Tag Decoration Mode:: Minor mode to decorate tags.
3149927d
CY
31@end menu
32
33@node Semantic mode
34@section Semantic mode
35@cindex Semantic mode
36
37Semantic mode is a global minor mode for @semantic{} as a whole. When
38enabled, each file you visit is automatically parsed, provided its
39major mode is specified in the variable
8e687433
CY
40@code{semantic-new-buffer-setup-functions} (the default value of this
41variable sets up parsing for all the parsers included with Emacs, but
42you may add to it if you install additional parsers).
3149927d
CY
43
44In each parser-enabled buffer, a number of @semantic{} commands are
45available for navigating, querying, and editing source code.
46@xref{Semantic mode user commands}. Enabling Semantic mode also
47installs a @samp{Development} menu on the menu-bar, with many of these
48commands.
49
be479117 50In addition, enabling Semantic mode turns on certain auxiliary global
8e687433
CY
51minor modes. The variable @code{semantic-default-submodes} determines
52which auxiliary modes are enabled; the defaults are SemanticDB mode
53(@pxref{SemanticDB}) and Global Semantic Idle Scheduler mode
54(@pxref{Idle Scheduler}). You can also toggle the auxiliary minor
1df7defd 55modes separately, using their mode functions (e.g., @kbd{M-x
8e687433
CY
56semanticdb-minor-mode}), or via the @samp{Development} menu. The
57various auxiliary minor modes are described in the following sections.
3149927d
CY
58
59@defvar semantic-new-buffer-setup-functions
60The value of this variable is an alist of functions to call for
61setting up @semantic{} parsing in the buffer. Each element has the
62form @code{(@var{mode} . @var{fn})}, where @var{mode} is a value of
63@code{major-mode} for the buffer and @var{fn} is the corresponding
64function for setting up the parser. @var{fn} is called, with no
65arguments, after the major mode is initialized (and after the mode
66hooks have been run).
67
68The default value enables @semantic{} for all supported major modes
69(i.e., C, C++, Scheme, Javascript, Java, HTML, SRecode, and Make), but
70you can remove modes from this list if you don't want to use
71@semantic{} with them.
72@end defvar
73
74@defvar semantic-default-submodes
75The value of this variable is a list of symbols, specifying the
be479117 76auxiliary minor modes to enable when enabling Semantic mode. The
3149927d
CY
77valid mode symbols are:
78
79@itemize
8e687433
CY
80@item @code{global-semantic-idle-scheduler-mode} (@pxref{Idle Scheduler}).
81@item @code{global-semanticdb-minor-mode} (@pxref{SemanticDB}).
82@item @code{global-semantic-idle-summary-mode} (@pxref{Idle Summary Mode}).
83@item @code{global-semantic-idle-completions-mode} (@pxref{Idle Completions Mode}).
84@item @code{global-semantic-highlight-func-mode} (@pxref{Highlight Func Mode}).
85@item @code{global-semantic-decoration-mode} (@pxref{Tag Decoration Mode}).
86@item @code{global-semantic-stickyfunc-mode} (@pxref{Sticky Func Mode}).
87@item @code{global-semantic-mru-bookmark-mode} (@pxref{MRU Bookmarks}).
3149927d
CY
88@end itemize
89@end defvar
90
91@menu
92* Semantic mode user commands::
93@end menu
94
95@node Semantic mode user commands
96@subsection Semantic mode user commands
97
98Semantic mode provides a number of commands for navigating, querying,
99and editing source code in a language-aware manner. These commands
100generally act on @dfn{tags}, which are the source-code units deemed
1df7defd 101``important'' by the present programming language (e.g., functions in
3149927d
CY
102the C programming language).
103
104These commands may be used in any buffer that has been parsed by
105@semantic{}. Several of them prompt for a tag name using the
106minibuffer; here, the @kbd{TAB} key can be used to complete tag names.
107Others act on the @dfn{current tag}, meaning the tag at (or around)
108point.
109
110@table @kbd
fd1cefda 111@item C-c , j
3149927d
CY
112Prompt for a tag defined in the current file, and move point to it
113(@code{semantic-complete-jump-local}).
114
fd1cefda 115@item C-c , J
3149927d
CY
116Prompt for a tag defined in any file that Emacs has parsed, and move
117point to it (@code{semantic-complete-jump}).
118
fd1cefda 119@item C-c , l
3149927d
CY
120Display a list of the possible completions of the current tag
121(@code{semantic-analyze-possible-completions}).
122
fd1cefda 123@item C-c , g
3149927d 124Prompt for a tag, and display a list of tags that call it
8e687433
CY
125(@code{semantic-symref-symbol}). This relies on the presence of an
126external symbol reference tool. @xref{SymRef}.
3149927d 127
fd1cefda 128@item C-c , G
3149927d 129Display a list of tags that call the current tag
8e687433
CY
130(@code{semantic-symref}). This relies on the presence of an external
131symbol reference tool. @xref{SymRef}.
3149927d 132
fd1cefda 133@item C-c , p
3149927d
CY
134Move point to the previous tag (@code{senator-previous-tag}).
135
fd1cefda 136@item C-c , n
3149927d
CY
137Move point to the next tag (@code{senator-next-tag}).
138
fd1cefda 139@item C-c , u
3149927d
CY
140Move point ``up'' one reference (@code{senator-go-to-up-reference}).
141The meaning of ``up'' is language-dependent; in C++, for instance,
142this means moving to the parent of the current tag.
143
fd1cefda
CY
144@item C-c, @key{SPC}
145Display a list of possible completions for the symbol at point
146(@code{semantic-complete-analyze-inline}). This also activates a
147special set of keybindings for choosing a completion: @key{RET}
148accepts the current completion, @kbd{M-n} and @kbd{M-p} cycle through
149possible completions, @key{TAB} completes as far as possible and then
150cycles, and @kbd{C-g} or any other key aborts the completion.
151@xref{Smart Completion}.
3149927d 152
fd1cefda 153@item C-c , C-w
3149927d
CY
154Kill the current tag (@code{senator-kill-tag}). This removes the text
155for that tag, placing it in the kill ring. You can retrieve the text
156with @kbd{C-y}. This also places the tag in the @dfn{tag ring}, so
157that you can yank it with @kbd{\C-c,\C-y}, below.
158
fd1cefda 159@item C-c , M-w
3149927d
CY
160Copy the current tag into the kill ring as well as the tag ring
161(@code{senator-copy-tag}).
162
fd1cefda 163@item C-c , C-y
3149927d
CY
164Yank a tag from the tag ring (@code{senator-yank-tag}).
165
fd1cefda 166@item C-c , r
3149927d
CY
167Copy the current tag into a register
168(@code{senator-copy-tag-to-register}). With an optional argument,
169kill it as well. This allows you to insert or jump to that tag with
170the usual register commands. @xref{Registers,,,emacs,Emacs manual}.
171
9fcfcdef 172@item C-c , @kbd{up}
3149927d
CY
173Transpose the current tag with the previous one
174(@code{senator-transpose-tags-up}).
175
fd1cefda 176@item C-c , @kbd{down}
3149927d
CY
177Transpose the current tag with the next one
178(@code{senator-transpose-tags-down}).
179@end table
180
181@node SemanticDB
182@section Semantic Database
183@cindex SemanticDB
184
185The Semantic Database (SemanticDB) caches the results of parsing
186source code files. This data can be saved to disk when you exit
187Emacs, and reloaded automatically when you subsequently revisit the
188same source code files. This saves time by eliminating the need to
189re-parse unmodified files.
190
191SemanticDB also provides an @acronym{API} that programs can use to
192acquire information about source code tags. This information can be
193accessed without loading the original the source files into memory.
194It can also be used to create alternate ``back-ends'' for storing tag
195information in alternative on-disk formats.
196
197By default, SemanticDB is enabled together with Semantic mode. To
198disable it, remove it from @code{semantic-default-submodes}
199(@pxref{Semantic mode}). You can also enable or disable SemanticDB
200with @kbd{M-x global-semanticdb-minor-mode}.
201
202@deffn Command global-semanticdb-minor-mode
203Toggle SemanticDB mode. When enabled, any source code parsed by
204@semantic{} is cached in a database.
205@end deffn
206
207SemanticDB offers a large number of customizable options, which are
208described in the following subsections.
209
210@menu
211* Semanticdb Tag Storage::
212* Semanticdb Search Configuration::
213* Changing Backends::
3149927d
CY
214* Create System Databases::
215@end menu
216
217@node Semanticdb Tag Storage
218@subsection Semanticdb Tag Storage
219
220Each time you exit Emacs, any data cached by SemanticDB is saved in
221the directory @file{.emacs.d/semanticdb/}, located in your home
222directory. Within this directory, the cache data is written into a
223set of files according to a SemanticDB-specific filename convention.
224If the SemanticDB directory does not exist, Emacs first asks if you
225want to create it.
226
227You can change the name of the SemanticDB directory by customizing the
228variable @code{semanticdb-default-save-directory}.
229
3149927d
CY
230@deffn Option semanticdb-default-save-directory
231The name of the directory where SemanticDB cache files are saved. If
232the value is @code{nil}, SemanticDB saves its data into a single file,
233in the current directory, whose filename is given by
234@code{semanticdb-default-file-name}.
235@end deffn
236
3149927d
CY
237@deffn Option semanticdb-default-file-name
238The name of a cache file in which to save SemanticDB, when
239@code{semanticdb-default-save-directory} is @code{nil}.
240@end deffn
241
242You can force SemanticDB to save the data from only certain files, or
243suppress saving altogether, by customizing
244@code{semanticdb-persistent-path}:
245
3149927d
CY
246@deffn Option semanticdb-persistent-path
247List of valid paths for SemanticDB to cache. Each element should be a
248directory name (a string); then the parse data from any file in that
249directory is saved.
250
251As a special exception, the value of this variable can be a list
252containing a single symbol: @code{never}, @code{always}, or
253@code{project}. The symbol @code{never} disables saving anywhere;
254@code{always} enables saving everywhere; and @code{project} enables
255saving directory based on the variable
256@code{semanticdb-project-predicate-functions}.
257
258The default value is @code{(always)}.
259@end deffn
260
3149927d
CY
261@defvar semanticdb-project-predicate-functions
262The value of this variable is a list of predicates for indicating that
263a directory belongs to a project. This list is used when the value of
264@code{semanticdb-persistent-path} is @code{(project)}. If the list is
265empty, all paths are considered valid.
266
267Project management packages, such as EDE (@pxref{Top,,,ede,EDE
268manual}), may add their own predicates with @dfn{add-hook} to this
269variable. This allows SemanticDB to save tag caches in directories
270controlled by them.
271@end defvar
272
d1069532 273@deffn Option semanticdb-save-database-functions
3149927d
CY
274Abnormal hook run after a database is saved. Each function is called
275with one argument, the object representing the database recently
276written.
277@end deffn
278
279@node Semanticdb Search Configuration
280@subsection Semanticdb Search Configuration
281
282 When another part of @semantic{} (or another Emacs package using
bd6f6833
CY
283@semantic{}) queries the SemanticDB library for a source code tag, the
284search need not be limited to tags defined within the current file.
285It can include tags defined elsewhere, such as @dfn{header files}
286referenced by the current file (e.g., via the C/C++ @code{#include}
287directive). While performing the search, the SemanticDB library may
288even automatically visit other files and parse them, if necessary.
289
290 The variable @code{semanticdb-find-default-throttle} determines how
291aggressively SemanticDB searches for source code tags. @xref{Search
292Throttle}.
293
294 The details of SemanticDB searches can vary from language to
295language. In C/C++ code, for example, SemanticDB distinguishes
296between @dfn{project header files} and @dfn{system header files},
297based on whether the @code{#include} directive uses the @code{""} or
298@code{<>} filename delimiter. SemanticDB looks for system header in
299the @dfn{system include path} (@pxref{Include paths}).
3149927d
CY
300
301@menu
8e687433
CY
302* Search Throttle:: Controlling how semanticdb searches occur.
303* Semanticdb Roots:: Specifying the root of different projects.
304* Include paths:: Specifying the directories to search.
3149927d
CY
305* Semanticdb search debugging commands::
306@end menu
307
bd6f6833
CY
308@node Search Throttle
309@subsubsection SemanticDB Search Throttle
310
311The SemanticDB @dfn{search throttle} determines how aggressive
312SemanticDB searches are. It is controlled by the variable
313@code{semanticdb-find-default-throttle}. The default value of this
314variable aims for maximum accuracy, at the expense of search time.
315
316Other parts of the @semantic{} package, particularly the different
317language parsers, may change the value of
318@code{semanticdb-find-default-throttle}. You can override its value,
319for a given major mode, like this:
320
321@example
322(setq-mode-local c-mode
9360256a
GM
323 semanticdb-find-default-throttle
324 '(project unloaded system recursive))
bd6f6833
CY
325@end example
326
bd6f6833
CY
327@defvar semanticdb-find-default-throttle
328The default throttle for @code{semanticdb-find} routines.
329The throttle controls how detailed the list of database
330tables is for a symbol lookup. The value is a list with
331the following keys:
332
333@table @code
334@item file
335The file the search is being performed from. This option is here for
336completeness only, and is assumed to always be on.
337@item local
338Tables from the same local directory are included. This includes
339files directly referenced by a file name which might be in a different
340directory.
341@item project
342Tables from the same local project are included If @code{project} is
343specified, then @code{local} is assumed.
344@item unloaded
345If a table is not in memory, load it. If it is not cached on disk
346either, get the source, parse it, and create the table.
347@item system
348Tables from system databases. These are specifically tables
349from system header files, or language equivalent.
350@item recursive
351For include based searches, includes tables referenced by included
352files.
353@item omniscience
354Included system databases which are omniscience, or somehow know
355everything. Omniscience databases are found in
356@code{semanticdb-project-system-databases}. The Emacs Lisp system
357@var{db} is an omniscience database.
358@end table
359@end defvar
360
3149927d
CY
361@node Semanticdb Roots
362@subsubsection SemanticDB project roots
363
bd6f6833
CY
364The @code{project} setting in the SemanticDB search throttle
365(@pxref{Search Throttle}) tells SemanticDB to search within the
366current single code project. For @semantic{}'s point of view,
367@dfn{projects} are determined by their top-level directories, or
368@dfn{project roots}; every subdirectory of a project root is
369considered part of the same project.
370
371If you use EDE for project management, it will set the project roots
372automatically. @xref{Top,,,ede,EDE manual}. You can also specify
373them yourself.
3149927d 374
3149927d
CY
375@deffn Option semanticdb-project-roots
376The value of this variable is a list of directories (strings) that are
bd6f6833 377project roots. All subdirectories of a project root are considered
0b381c7e 378part of the same project. This variable can be overridden by
bd6f6833 379@code{semanticdb-project-root-functions}.
3149927d
CY
380@end deffn
381
3149927d
CY
382@defvar semanticdb-project-root-functions
383The value of this variable is a list of functions to determine a given
384directory's project root. These functions are called, one at a time,
385with one argument (the directory name), and must return either
386@code{nil}, a string (the project root), or a list of strings
387(multiple project roots, for complex systems). The first
388non-@code{nil} return value, if any, is taken to be the project root,
389overriding @code{semanticdb-project-roots}.
390@end defvar
391
3149927d
CY
392@node Include paths
393@subsubsection Include Paths
394
395System include paths are standard locations to find source code tags,
396such as the @dfn{header files} in @file{/usr/include} and its
bd6f6833
CY
397subdirectories on Unix-like operating systems.
398
399You can add and remove system include paths using the following
400commands:
3149927d 401
3149927d 402@deffn Command semantic-add-system-include dir &optional mode
bd6f6833
CY
403Prompts for a directory, @var{dir}, and add it as a system include
404path for the current major mode. When called non-interactively, the
405major mode can be specified with the @var{mode} argument.
3149927d
CY
406@end deffn
407
3149927d 408@deffn Command semantic-remove-system-include dir &optional mode
bd6f6833
CY
409Prompt for a directory, @var{dir}, and remove it from the system
410include path for the current major mode (or @var{mode}).
3149927d
CY
411@end deffn
412
3149927d
CY
413@deffn Command semantic-customize-system-include-path &optional mode
414Customize the system include path for the current major mode (or
be479117 415@var{mode}).
3149927d
CY
416@end deffn
417
3149927d
CY
418@defun semanticdb-implied-include-tags
419Include tags implied for all files of a given mode. You can set this
420variable with @code{defvar-mode-local} for a particular mode so that
421any symbols that exist for all files for that mode are included.
422@end defun
423
424@c @xref{Search Optimization}, for more information on include paths.
425
3149927d
CY
426@node Semanticdb search debugging commands
427@subsubsection Semanticdb search debugging commands
428
bd6f6833
CY
429You can use @kbd{M-x semanticdb-dump-all-table-summary} to see the
430list of databases that will be searched from a given buffer. You can
431follow up with @kbd{M-x semanticdb-find-test-translate-path} to then
432make sure specific tables from the path are discovered correctly.
3149927d 433Alternately, you can get a list of include files @semantic{}
bd6f6833
CY
434encountered, but could not find on disk using @kbd{M-x
435semanticdb-find-adebug-lost-includes}.
3149927d
CY
436
437@deffn Command semanticdb-dump-all-table-summary
3149927d
CY
438Dump a list of all databases in Emacs memory.
439@end deffn
440
fd1cefda
CY
441@deffn Command semanticdb-find-test-translate-path &optional arg
442Call and output results of @dfn{semanticdb-find-translate-path}. In
443the displayed buffer, you can type @key{SPC} to expand items. With
444@var{arg} non-@code{nil}, specify a @var{brutish} translation.
3149927d
CY
445@end deffn
446
447@deffn Command semanticdb-find-adebug-lost-includes
3149927d
CY
448Translate the current path, then display the lost includes.
449Examines the variable @code{semanticdb-find-lost-includes}.
450@end deffn
451
452Lastly, you can test an explicit search term using this command:
453
454@deffn Command semantic-adebug-searchdb regex
3149927d
CY
455Search the semanticdb for @var{regex} for the current buffer.
456Display the results as a debug list.
457@end deffn
458
459@node Changing Backends
460@subsection Changing Backends
461
462If you want to use some other form of backend, you can use this
463variable to choose which back end class to use for your general tag
464storage.
465
466The default is to save databases in flat files. Alternatively, you
467could write a new database backend that stores tags into a database,
468or other storage system.
469
bd6f6833
CY
470@defvar semanticdb-new-database-class
471The default type of database created for new files. This can be
472changed on a per file basis, so that some directories are saved using
473one mechanism, and some directories via a different mechanism.
3149927d
CY
474@end defvar
475
3149927d
CY
476@node Create System Databases
477@subsection Create System Databases
478
479If your supported language stores the system libraries in readily
480available parsable source code, you can pre-generate database files
481for them once, which will be used over and over for tools such as
482summary-mode, or the analyzer.
483
484@deffn Command semanticdb-create-ebrowse-database dir
3149927d
CY
485Create an @var{ebrowse} database for directory @var{dir}.
486The database file is stored in ~/.semanticdb, or whichever directory
487is specified by @code{semanticdb-default-system-save-directory}.
488@end deffn
489
3149927d
CY
490@node Idle Scheduler
491@section Idle Scheduler
492@cindex Idle Scheduler
493
8e687433 494The @dfn{Semantic Idle Scheduler} is a part of @semantic{} that
bd6f6833 495performs various operations while Emacs is waiting for user input
8e687433
CY
496(idle time). Its primary job is to perform buffer parsing during idle
497time. You can also use the Idle Scheduler to display function
498prototypes (@pxref{Idle Summary Mode}) or symbol completions
499(@pxref{Idle Completions Mode}).
3149927d 500
bd6f6833
CY
501@deffn Command global-semantic-idle-scheduler-mode &optional arg
502This command toggles Semantic Idle Scheduler mode in every
503@semantic{}-enabled buffer. This minor mode ensures that the buffer
504is automatically reparsed whenever Emacs is idle. If there is
505additional idle time, it runs jobs scheduled by other parts of
506@semantic{}, such as Semantic Idle Summary mode (@pxref{Idle Summary
507Mode}) and Semantic Idle Completions mode (@pxref{Idle Completions
508Mode}).
3149927d
CY
509@end deffn
510
bd6f6833
CY
511@deffn Option semantic-idle-scheduler-idle-time
512The value of this variable is the amount of idle time, in seconds,
513before the Semantic idle scheduler activates. The default is 1.
3149927d
CY
514@end deffn
515
bd6f6833
CY
516@deffn Option semantic-idle-scheduler-verbose-flag
517If this variable is non-@code{nil}, the idle scheduler prints verbose
518messages while running, which are useful for debugging.
3149927d
CY
519@end deffn
520
3149927d 521@menu
8e687433
CY
522* Reparsing Options:: Reparsing the current buffer in idle time.
523* Idle Working Options:: Options for extra work done at idle time.
524* Debugging Idle Time Issues:: How to produce good bug reports.
525* Idle Summary Mode:: Display prototype of symbol under cursor.
526* Idle Completions Mode:: Smart completion pop-up help.
3149927d
CY
527@end menu
528
529@node Reparsing Options
530@subsection Reparsing Options
531
bd6f6833
CY
532When activated during idle time, the Semantic idle scheduler
533automatically reparses all buffers that need it. Any arriving user
534input cancels this, returning Emacs to its normal editing behavior.
3149927d 535
bd6f6833
CY
536@deffn Option semantic-idle-scheduler-max-buffer-size
537Maximum size in bytes of buffers automatically reparsed. If this
538value is less than or equal to @var{0}, buffers are automatically
3149927d
CY
539reparsed regardless of their size.
540@end deffn
541
bd6f6833 542@deffn Option semantic-idle-scheduler-no-working-message
ee7683eb 543If non-@code{nil}, disable display of working messages while reparsing.
3149927d
CY
544@end deffn
545
bd6f6833
CY
546@deffn Option semantic-idle-scheduler-working-in-modeline-flag
547If non-@code{nil}, show working messages in the mode line. Normally,
548re-parsing shows messages in the minibuffer; this moves the parse
549message to the modeline instead.
3149927d
CY
550@end deffn
551
bd6f6833
CY
552@defvar semantic-before-idle-scheduler-reparse-hook
553This normal hook is run just before the idle scheduler begins
554reparsing. If any hook function throws an error, the value of this
555variable is reset to @code{nil}. This hook is not protected from
556lexical errors.
3149927d
CY
557@end defvar
558
bd6f6833
CY
559@defvar semantic-after-idle-scheduler-reparse-hook
560
561This normal hook is run after the idle scheduler finishes reparsing.
562If any hook throws an error, this variable is reset to @code{nil}.
3149927d
CY
563This hook is not protected from lexical errors.
564@end defvar
565
566@node Idle Working Options
567@subsection Idle Working Options
568
673286f5
CY
569In addition to reparsing buffers, the Semantic idle scheduler performs
570additional operations, including the following:
3149927d 571
673286f5
CY
572@itemize
573@item
574Creating the include path caches required for symbol lookup.
575@item
576Create data type caches.
577@item
578Saving SemanticDB caches to disk.
579@item
580Speculatively parsing the files in the same directory as the current
581buffer.
582@end itemize
583
584Because this extra work is quite time-consuming, it is only carried
585out after a longer idle delay. The following features control how the
586idle work is performed.
3149927d 587
673286f5
CY
588@deffn Option semantic-idle-scheduler-work-idle-time
589The value of this variable is the amount of idle time, in seconds,
590before commencing idle work. The default is 60.
3149927d
CY
591@end deffn
592
673286f5
CY
593@deffn Option semantic-idle-work-parse-neighboring-files-flag
594If the value of this variable is non-@code{nil}, the Semantic idle
595scheduler uses idle work time to parse files in the same directory as
596the current buffer. This improves the accuracy of tag searches and
597saves time when visiting those files later, at the cost of doing a lot
598of parsing. The default is @code{t}.
3149927d
CY
599@end deffn
600
601@node Debugging Idle Time Issues
602@subsection Debugging Idle Time Issues
603
8350f087 604If you see an error signaled during idle time, it could be an
673286f5
CY
605indication of a more serious issue elsewhere. It is not enough to
606enable @code{debug-on-error}, because the idle scheduler inhibits the
607debugger. Instead, use the following commands to debug the error:
3149927d
CY
608
609@deffn Command semantic-debug-idle-function
3149927d
CY
610Run the Semantic idle function with debugging turned on.
611@end deffn
612
613@deffn Command semantic-debug-idle-work-function
3149927d
CY
614Run the Semantic idle work function with debugging turned on.
615@end deffn
616
3149927d
CY
617@node Idle Summary Mode
618@subsection Idle Summary Mode
619
673286f5
CY
620Semantic Idle Summary mode is a minor mode that displays a short
621summary of the symbol at point, such as its function prototype, in the
622echo area. Its functionality is similar to what ElDoc mode provides
623for Emacs Lisp (@pxref{Lisp Doc,,,emacs,Emacs manual}).
3149927d 624
673286f5
CY
625@deffn global-semantic-idle-summary-mode &optional arg
626This command toggles Semantic Idle Summary mode in all
627@semantic{}-enabled buffers. You can also toggle it via the
628@samp{Show Tag Summaries} menu item in the @samp{Development} menu.
3149927d
CY
629@end deffn
630
673286f5
CY
631When Semantic Idle Summary mode is active, a summary of the tag at
632point is displayed in the echo area. This display takes place during
633the idle time, as given by @code{semantic-idle-scheduler-idle-time}
634(@pxref{Idle Scheduler}).
635
636You can override the method for getting the current tag to display by
637setting @code{idle-summary-current-symbol-info}.
3149927d 638
673286f5
CY
639@deffn Option semantic-idle-summary-function
640The value of this variable should be a function to call to display tag
641information during idle time. See the variable
642@code{semantic-format-tag-functions} for a list of useful functions.
3149927d
CY
643@end deffn
644
673286f5
CY
645@defvar semantic-idle-summary-out-of-context-faces
646The value of this variable is a list of font-lock faces indicating
647useless summary contexts. These are generally faces used to highlight
648comments or strings. Semantic Idle Summary mode does not display its
649usual summary if the text at point has one of these faces.
3149927d
CY
650@end defvar
651
652@node Idle Completions Mode
653@subsection Idle Completions Mode
654
673286f5
CY
655Semantic Idle Completions mode is a minor mode for performing
656@dfn{code completions} during idle time. The completions are
657displayed inline, with keybindings that allow you to cycle through
658different alternatives.
3149927d 659
fd1cefda
CY
660Semantic Idle Completions mode performs completion based on the
661Semantic Analyzer (@pxref{Analyzer}).
3149927d 662
673286f5
CY
663@deffn global-semantic-idle-completions-mode &optional arg
664This command toggles Semantic Idle Completions mode in every
665@semantic{}-enabled buffer. You can also toggle it via the @samp{Show
666Tag Completions} menu item in the @samp{Development} menu.
3149927d
CY
667@end deffn
668
673286f5
CY
669If the tag at point has at least one completion, Semantic Idle
670Completions mode displays that completion inline---i.e., as part of
671the buffer text (you can change the display method by customizing
672@code{semantic-complete-inline-analyzer-idle-displayor-class}, as
673described below). The completed part is highlighted, to indicate that
674it is not yet properly inserted into the buffer. The echo area shows
675the completion, and whether there are other possible completions, like
676this:
3149927d 677
673286f5
CY
678@example
679besselj [1 of 6 matches]
680@end example
681
682@noindent
683While the completion is being displayed, the following keybindings
684take effect:
685
686@table @kbd
687@item @key{RET}
688@itemx C-m
689Accept the current completion (@code{semantic-complete-inline-done}),
690placing it in the buffer and moving point to the end of the completed
691tag.
692@item M-n
693Select the next possible completion
694(@code{semantic-complete-inline-down}). The new completion is shown
695inline, replacing the old completion.
696@item M-p
697Select the previous possible completion
698(@code{semantic-complete-inline-up}).
699@item @key{TAB}
700@item C-i
701Accept as much of the completion as possible. If no additional
702completion can be accepted without ambiguity, select the next possible
703completion (@code{semantic-complete-inline-TAB}).
704@item C-g
705Quit without completing (@code{semantic-complete-inline-quit}).
706@end table
707
708@noindent
709You can also exit inline completion by issuing any other Emacs
710command. The completion text then disappears from the buffer.
3149927d 711
673286f5
CY
712@deffn Command semantic-complete-analyze-inline-idle
713This is the command for performing inline code completion. It is
714called by Semantic Idle Completions mode during idle time, but you can
715also call it yourself. It returns immediately, leaving the buffer in
716a state for inline completion.
3149927d
CY
717@end deffn
718
673286f5
CY
719@deffn Option semantic-complete-inline-analyzer-idle-displayor-class
720The value of this variable determines how
721@code{semantic-complete-analyze-inline-idle} shows its completions.
722Possible values include:
3149927d 723
673286f5
CY
724@table @code
725@item semantic-displayor-ghost
726Display completions ``inline'' with the buffer text, as described
727above. This is the default value.
728
729@item semantic-displayor-tooltip
730Display completions in a tooltip.
731
732@item semantic-displayor-traditional
733Display completions in a separate window.
734@end table
3149927d 735@end deffn
fd1cefda
CY
736
737@node Analyzer
738@section Analyzer
739@cindex Analyzer
740
741The Semantic Analyzer is a library for performing context analysis on
742source code. It provides user commands for displaying, completing,
743and navigating through source code.
744
745@menu
746* Smart Completion:: Performing code completion.
747* Smart Summary:: Displaying help on a symbol.
748* Smart Jump:: Jumping to the definition of a tag.
749* Analyzer Debug:: Debugging problems with the analyzer.
750@end menu
751
752@node Smart Completion
753@subsection Smart Completion
754
755The Semantic Analyzer can be used to perform code completion in a
8e687433
CY
756manner that takes the local context into account. (In addition to the
757user commands in this section, Semantic Idle Completions mode also
758uses the Semantic Analyzer. @xref{Idle Completions Mode}.)
fd1cefda
CY
759
760@deffn Command semantic-analyze-possible-completions context
761This is the most basic command for Semantic Analyzer-based completion.
8e687433
CY
762Called interactively, it displays a list of the possible completions
763for the symbol at point.
fd1cefda
CY
764
765When called from a Lisp program,
766@code{semantic-analyze-possible-completions} does not display a
767completions list. The argument @var{context} should be either a
768buffer position, or a context object. The return value is a list of
769@semantic{} tag objects that complete the symbol for @var{context},
770based on the following criteria:
771
772@itemize
773@item Elements currently in scope.
774@item Constants currently in scope.
775@item Elements matching the context's @code{:prefix}.
776@item Type of the completion matching the type of the context.
777@end itemize
778
779Most of the other commands documented in this section call
780@code{semantic-analyze-possible-completions} internally.
781@end deffn
782
fd1cefda
CY
783@deffn Command semantic-complete-analyze-inline
784This command is bound to @kbd{C-c , @key{SPC}} when Semantic mode is
785enabled (@pxref{Semantic mode user commands}). It displays a list of
786possible completions for the symbol at point, and activates a special
787set of keybindings for choosing a completion.
788
789You can type @key{RET} to accept the current completion, @kbd{M-n} and
790@kbd{M-p} to cycle through the possible completions, @key{TAB} to
791complete as far as possible and then cycle through completions, and
792either @kbd{C-g} or any other key to abort the completion.
793
794This command is similar to the completion performed by Semantic Idle
795Completions mode. The main difference is that it is called
796explicitly, whereas Semantic Idle Completions mode completes during
797idle time (@pxref{Idle Completions Mode}).
798@end deffn
799
fd1cefda
CY
800@deffn Option semantic-complete-inline-analyzer-idle-displayor-class
801The value of this variable determines how
802@code{semantic-complete-analyze-inline} shows its completions.
803Possible values include:
804
805@table @code
806@item semantic-displayor-traditional
807Display completions in a separate window. This is the default value.
808
809@item semantic-displayor-ghost
810Display completions ``inline'' with the buffer text, similar to the
811default behavior of Semantic Idle Completions mode (@pxref{Idle
812Completions Mode}).
813
814@item semantic-displayor-tooltip
815Display completions in a tooltip.
816@end table
817@end deffn
818
819In addition to @code{semantic-complete-analyze-inline}, you can use
820the simpler command @code{semantic-ia-complete-symbol point}. This
821behaves like the usual @kbd{M-@key{TAB}} (@code{complete-symbol})
822command (@pxref{Symbol Completion,,,emacs,Emacs manual}), except it
8e687433 823uses the Semantic Analyzer.
fd1cefda 824
fd1cefda
CY
825@deffn Command semantic-ia-complete-symbol point
826Complete the current symbol at @var{point}.
827@end deffn
828
829@node Smart Summary
830@subsection Smart Summary
831
8e687433 832You can use the following commands to obtain information about the
fd1cefda
CY
833code at point:
834
fd1cefda
CY
835@deffn Command semantic-ia-show-summary pos
836Display a summary for the symbol at @var{pos}. Called interactively,
837@var{pos} defaults to point.
838@end deffn
839
fd1cefda
CY
840@deffn Command semantic-ia-show-doc pos
841Display the code-level documentation for the symbol at @var{pos}.
842Called interactively, @var{pos} defaults to point.
843@end deffn
844
fd1cefda
CY
845@deffn Command semantic-ia-describe-class typename
846Prompt for the name of a data type, @var{typename}, and display its
847components. For instance, if the type in question is a class, this
848displays the methods and member variables.
849@end deffn
850
851You can also use Semantic Idle Summary mode to show information about
852the current symbol in the echo area during idle time. @xref{Idle
853Summary Mode}.
854
855@node Smart Jump
856@subsection Smart Jump
857
858The Semantic Analyzer can be used to jump directly to the definition
8e687433 859for a code symbol.
fd1cefda 860
fd1cefda
CY
861@deffn Command semantic-ia-fast-jump pos
862Jump to the definition for the symbol at @var{pos}. Called
863interactively, @var{pos} defaults to point.
864@end deffn
865
fd1cefda
CY
866@defun semantic-ia-fast-mouse-jump event
867Jump to the definition for the symbol at the position of the mouse
868event @var{event}. This command is meant to be bound to a mouse
869command, like this:
870
871@example
872(global-set-key '[(S-mouse-1)] semantic-ia-fast-mouse-jump)
873@end example
874@end defun
875
fe7a3057 876These commands are often more accurate than the @code{find-tag}
8e687433
CY
877command (@pxref{Tags,,,emacs,Emacs manual}), because the Semantic
878Analyzer is context-sensitive.
879
fd1cefda
CY
880You can also use @kbd{C-c , j} (@code{semantic-complete-jump-local})
881and @kbd{C-c , J} (@code{semantic-complete-jump}) to navigate tags.
882@xref{Semantic mode user commands}. Those commands do not make use of
883the Semantic Analyzer.
884
885@node Analyzer Debug
886@subsection Debugging the Semantic Analyzer
887
8e687433
CY
888If the Semantic Analyzer does not analyze your code properly, you can
889take steps to identify and solve the problem. This section was
890written with C/C++ in mind, but should be relevant for any typed
891language.
fd1cefda
CY
892
893@subsubsection Step 1: Check the context
894
8e687433
CY
895To check the current context, type @kbd{M-x
896semantic-analyze-current-context}.
fd1cefda
CY
897
898@deffn Command semantic-analyze-current-context pos
899Analyze the context at @var{pos}. This function is used by most of
900the other Semantic Analyzer commands to obtain the context of the code
901at a given buffer position. The return value is an EIEIO object
902describing the context at @var{pos} (@pxref{Top,,,eieio,EIEIO
903manual}).
904
905When called interactively, this displays a @samp{*Semantic Context
8e687433 906Analysis*} buffer containing a summary of the context at point.
fd1cefda
CY
907@end deffn
908
8e687433 909@noindent
fd1cefda
CY
910The Prefix section of the @samp{*Semantic Context Analysis*} buffer
911lists the tags based on the text at point. If it shows only a simple
912string, the Semantic was unable to identify what the data type was.
913
914The first item in the list of the prefix is the first lookup failure
915in the chain, and that is the item to focus debugging effort on. For
916example:
917
918@example
919Context Type: #<semantic-analyze-context context>
920Bounds: (182 . 185)
921Prefix: Foo* bar
922 int bbb (const char* y)
923Prefix Types: class Foo @{@}
924--------
925-> Local Vars: int argc
926 char** argv
927@end example
928
929In this example you can see that the prefix has two fully found tags.
930In the following example, the symbol ``bbb'' is incomplete, and could
931not be found:
932
933@example
934Context Type: #<semantic-analyze-context context>
935Bounds: (182 . 184)
936Prefix: Foo* bar
937 "bb"
938Prefix Classes: 'function
939 'variable
940Prefix Types: class Foo @{@}
941--------
942-> Local Vars: int argc
943 char** argv
944@end example
945
946@subsubsection Step 2 : Check your include path
947
8e687433
CY
948Once you know the missing symbol, check your include path. The header
949or include file containing the needed definition may not be in the
950list of headers @semantic{} is searching through. To get a basic
951list, you can use @kbd{M-x semanticdb-find-test-translate-path}.
952@xref{Semanticdb search debugging commands}.
fd1cefda 953
8e687433
CY
954If items should be loaded but aren't, or if you see some tables that
955have no tags in them, then you you may have an incorrectly-set search
956throttle (@pxref{Search Throttle}). For example,
fd1cefda
CY
957
958@example
959*#<semanticdb-table main.cpp (4 tags DIRTY)>
960*#<semanticdb-table foo.hh (0 tags DIRTY)>
961@end example
962
963Here, @semantic{} found @file{foo.hh}, but there are 0 tags. This may
8e687433
CY
964be because you had set the throttle to avoid reading and parsing files
965that Emacs has not visited. To fix this, visit the file and let
966@semantic{} parse it.
967
968For C++, check also that the @samp{#include} statements for your
969project-level files use quotes, not angle brackets; angle brackets are
970for system files.
fd1cefda
CY
971
972@subsubsection Step 3: Check the local scope
973
974If your data type is somehow abbreviated based on scope, such as from
975a @code{using} statement, you should make sure that the symbol you
976want is in the local scope. Examine the scope with @kbd{M-x
977semantic-calculate-scope}. The scope structure is displayed in ADEBUG
978mode, so use @kbd{SPC} to expand different elements and looking for
979your symbol.
980
981If your symbol should be in the scope, but you cannot find it, then
982you may have found a language support bug in the local-variable
983parser, or using statement parser.
984
985Calling @kbd{M-x bovinte} should force a reset on the scope in case
986there is merely some bad state.
987
988@example
989 ] Name: Cache
990 ] Class: #'semantic-scope-cache
991 ] :table #<semanticdb-table testsubclass.cpp (13 tags DIRTY)>
992 ] tag createMoose : class moose
993 ] scopetypes 'nil
994 ] parents #<TAG LIST: 1 entries>
995 ] scope #<TAG LIST: 22 entries>
996 ] fullscope #<TAG LIST: 23 entries>
997 ] localvar #<TAG LIST: 6 entries>
998@end example
999
1000In the above sample output, the @code{tag} slot specifies where within
1001you source this scope is relevant. @code{Parents} should contain any
1002in scope parents, such as the class a method belongs to.
1003@code{Localvar} should contain your local variables. @code{Scope}
1004should contain datatypes in scope due to a @code{using} statement or
1005the like.
1006
1007@subsubsection Step 4: Check the typecache
1008
1009For complex typed languages like C++, @semantic{} creates a typecache,
1010or an optimized search table with all the various data types in it.
1011Elements in the typecache do not obey local scope. It only contains
1012fully qualified names. You can examine the typecache with
1013@kbd{M-x semanticdb-typecache-dump}.
1014
1015If your data types are not in the typecache, there may be some parsing
1016error or other bug. Calling @kbd{M-x bovinte} should force a reset on
1017the typecache in case there is merely some bad state.
1018
1019@example
1020]#<semanticdb-typecache /home/zappo/cedet/semantic/tests/testsubclass.cpp>
1021 ] Name: /home/zappo/cedet/semantic/tests/testsubclass.cpp
1022 ] Class: #'semanticdb-typecache
1023 ] filestream 'nil
1024 ] includestream #<TAG LIST: 84 entries>
1025 ] stream 'nil
1026 ] dependants 'nil
1027@end example
1028
1029In the above example, the output of @kbd{M-x semanticdb-typecache-dump}
1030was expanded one level. The @code{filestream} slot should contain
1031datatypes in the current file. The @code{includestream} should
1032contain all the datatypes in all included header files.
1033
1034The @code{dependants} slot will specify other files that depend on
1035this one.
1036
8e687433 1037@subsubsection Step 5: Check the parser
fd1cefda
CY
1038
1039Go to the location where your unfound tag should be. You can call
1040@kbd{M-x bovinate}, and see a dump of the raw tag structure. To see a
1041navigable tree, use @kbd{M-x semantic-adebug-bovinate} instead. You
1042can then look to make sure your tag has been properly parsed.
1043
1044If it has not, then you may have found a parser bug. To get a feel
1045how @semantic{} treats your file, type @kbd{M-x
1046global-semantic-show-unmatched-syntax-mode}. This causes any syntax
1047it cannot parse to be underlined in red.
1048
1049If your type is not parsable, it could be for a couple of reasons:
1050
1051@enumerate
1052@item
1053If there is a MACRO keyword used in the definition of the type, you
1054may need to update the @code{semantic-lex-c-preprocessor-symbol-map}
1055to account for it.
1056
1057@item
1058Or perhaps the parser needs to be fixed.
1059@end enumerate
964f5b2b 1060
8e687433
CY
1061@node Speedbar
1062@section Speedbar
1063@cindex speedbar
1064
1065You can integrate @semantic{} with the Speedbar.
1066@xref{Speedbar,,,emacs,Emacs manual}. To do this, add the following
1067line to your init file:
1068
1069@example
1070(add-hook 'speedbar-load-hook (lambda () (require 'semantic/sb)))
1071@end example
1072
1073@noindent
1074Or, alternatively:
1075
1076@example
1077(require 'semantic/sb)
1078@end example
1079
1080Once installed, the Speedbar will use @semantic{} to find and display
1081tags. Tags from @semantic{} are displayed with more details than
1082ordinary Speedbar tags, such as function arguments and return type.
1083
1084In addition, you can use the Speedbar to show the output of the
1085Semantic Analyzer (@pxref{Analyzer}). To do this, go to the
1086@samp{Display} menu item on the Speedbar menu and select
1087@samp{Analyze}; or type @kbd{M-x semantic-speedbar-analysis}.
1088
1089@deffn Command semantic-speedbar-analysis
1090Start the Speedbar in Semantic Analysis mode.
1091@end deffn
1092
1093In Semantic Analysis mode, the Speedbar displays information about the
1094local context, such as the current function, local arguments and
1095variables, and details on the prefix (the current symbol). Each entry
1096has an @samp{<i>} button; clicking on this shows a summary of what
1097@semantic{} knows about that variable or type. The Speedbar also
1098displays a list of possible completions at point.
1099
1100@node SymRef
1101@section Symbol References
1102@cindex symref
1103
1104@semantic{} can interface with external @dfn{symbol reference tools},
1105such as GNU Global and GNU Idutils. These tools provide information
1106about where different tags or symbols appear.
1107
1108By default, @semantic{} tries to look for the best external symbol
1109reference tool that can be used. The supported tools are GNU Global,
1110GNU Idutils, CScope, and Grep (the fallback method). For best
1111results, use GNU Global. However, @semantic{} does not manage your
1112GNU Global tables for you; you must manage them yourself.
1113
1114@defvar semantic-symref-tool
1115The value of this variable is a symbol that determines the external
1116symbol reference tool to use. The default value, @code{detect}, says
1117to look for the best available tool. Other possible values are
1118@code{global}, @code{idutils}, @code{cscope}, and @code{grep}. Note
1119that @code{grep} is much slower than the others.
1120@end defvar
1121
1122The commands to display symbol references are @kbd{C-c , g}
1123(@code{semantic-symref-symbol} and @kbd{C-c , G}
1124(@code{semantic-symref}). These keybindings are available whenever
1125Semantic mode is enabled (@pxref{Semantic mode user commands}).
1126
1127@deffn Command semantic-symref-symbol sym
1128This command (normally bound to @kbd{C-c , g}) prompts for a symbol
1129name, and uses an external reference tool to find references to that
1130tag.
1131@end deffn
1132
1133@deffn Command semantic-symref
1134This command (normally bound to @kbd{C-c , G}) uses an external
1135reference tool to find references to the current tag.
1136@end deffn
1137
1138Both @code{semantic-symref-symbol} and @code{semantic-symref} display
1139a list of symbol references in a separate buffer. The entries are
1140organized by file, and by function name. Typing @key{RET} on the
1141@samp{[+]} next to each function name ``expands'' that entry, listing
1142all references to the target symbol occurring within that function.
1143Typing @kbd{RET} on a reference line jumps to that reference.
1144
1145@node MRU Bookmarks
1146@section MRU Bookmarks mode
1147@cindex semantic-mru-bookmark-mode
1148
1149Semantic MRU Bookmarks mode is a minor mode that keeps track of the
1150tags you have edited, allowing you to quickly return to them later
1151(MRU stands for ``Most Recently Used'').
1152
1153@deffn Command global-semantic-mru-bookmark-mode &optional arg
1154Toggle Semantic MRU Bookmarks mode globally. The minor mode can be
1155turned on only if the current buffer was set up for parsing. With
1156argument @var{arg}, turn the minor mode if @var{arg} is positive, and
1157off otherwise.
1158@end deffn
1159
1160Semantic MRU Bookmarks mode takes note of each tag you edit.
1161Afterwards, you can type @kbd{C-x B}
1162(@code{semantic-mrub-switch-tags}) to return to a tag. This command
1163prompts for a tag name, completing with the names of edited tags; at
1164the prompt, you can use @kbd{M-p} and @kbd{M-n} to cycle through tags
1165in order of last modification time.
1166
1167@node Sticky Func Mode
1168@section Sticky Function mode
1169
1170Semantic Sticky Function minor mode displays a header line that shows
1171the declaration line of the function or tag on the topmost line in the
1172text area. This allows you to keep that declaration line in view at
1173all times, even if it is scrolls off the ``top'' of the screen.
1174
1175In addition, clicking @kbd{Mouse-1} on the header line opens a context
1176menu that contains menu items for copying, killing, or narrowing to
1177that tag.
1178
1179@deffn Command global-semantic-stickyfunc-mode &optional arg
1180Toggle Semantic Sticky Function mode in all Semantic-enabled buffers.
1181With an optional argument @var{arg}, enable if @var{arg} is positive,
1182and disable otherwise.
1183@end deffn
1184
1185@defvar semantic-stickyfunc-sticky-classes
1186The value of this variable is a list of tag classes that Semantic
1187Sticky Function mode makes ``sticky''. The default is
1188@code{'(function type)}, meaning function declarations and type
1189declarations. Other possible tag classes are @code{variable},
1190@code{include}, and @code{package}.
1191@end defvar
1192
1193@node Highlight Func Mode
1194@section Highlight Func Mode
1195@cindex semantic-highlight-func-mode
1196
1197Semantic Highlight Function minor mode highlights the declaration line
1198of the current function or tag (that is to say, the first line that
1199describes the rest of the construct).
1200
1201In addition, clicking @kbd{Mouse-3} on the highlighted declaration
1202line opens a context menu that contains menu items for copying,
1203killing, or narrowing to that tag.
1204
1205The tag classes highlighted by Semantic Highlight Function mode are
1206the same ones given by @code{semantic-stickyfunc-sticky-classes}.
1207@xref{Sticky Func Mode}.
1208
1209@defun global-semantic-highlight-func-mode &optional arg
1210Toggle Semantic Highlight Function mode in all Semantic-enabled
1211buffers. With an optional argument @var{arg}, enable if @var{arg} is
1212positive, and disable otherwise.
1213@end defun
1214
1215@deffn Face semantic-highlight-func-current-tag-face
1216This face is used to highlight declaration lines in Semantic Highlight
1217Func mode.
1218@end deffn
1219
1220@node Tag Decoration Mode
1221@section Tag Decoration Mode
1222@cindex semantic-decoration-mode
1223
1224Semantic Tag Decoration mode ``decorates'' each tag based on certain
1225arbitrary features of that tag. Decorations are specified using the
1226variable @code{semantic-decoration-styles}.
1227
1228@deffn Command global-semantic-decoration-mode &optional arg
1229Toggle Semantic Tag Decoration mode in all Semantic-enabled buffers.
1230With an optional argument @var{arg}, enable if @var{arg} is positive,
1231and disable otherwise.
1232@end deffn
1233
1234@defvar semantic-decoration-styles
1235The value of this variable is a list of decoration styles for Semantic
1236Tag Decoration mode. Each element in this list should have the form
1237@code{(@var{name} . @var{flag})}, where @var{name} is a style name (a
1238symbol) and @var{flag} is non-@code{nil} if the style is enabled.
1239
1240The following styles are available:
1241
1242@table @code
1243@item semantic-tag-boundary
1244Place an overline in front of each long tag (excluding prototypes).
1245
1246@item semantic-decoration-on-private-members
1247Highlight class members that are designated as private.
1248
1249@item semantic-decoration-on-protected-members
1250Highlight class members that are designated as protected.
1251
1252@item semantic-decoration-on-includes
1253Highlight class members that are includes. Clicking on the
1254highlighted include statements opens a context menu for configuring
1255@semantic{} includes.
1256@end table
1257@end defvar
1258
1259To enable or disable specific decorations, use this function:
1260
1261@deffn Command semantic-toggle-decoration-style name &optional arg
1262Prompt for a decoration style, @var{name}, and turn it on or off.
1263With prefix argument @var{arg}, turn on if positive, otherwise off.
1264Return non-@code{nil} if the decoration style is enabled.
1265@end deffn
1266
1267@deffn Face semantic-tag-boundary-face
1268Face for long tags in the @code{semantic-tag-boundary} decoration
1269style.
1270@end deffn
1271
1272@deffn Face semantic-decoration-on-private-members-face
1273Face for privately-scoped tags in the
1274@code{semantic-decoration-on-private-members} decoration style.
1275@end deffn
1276
1277@deffn Face semantic-decoration-on-protected-members-face
1278Face for protected tags in the
1279@code{semantic-decoration-on-protected-members} decoration style.
1280@end deffn
1281
1282@deffn Face semantic-decoration-on-includes
1283Face for includes that are not in some other state, in the
1284@code{semantic-decoration-on-includes} decoration style.
1285@end deffn
1286
1287@deffn Face semantic-decoration-on-unknown-includes
1288Face for includes that cannot be found, in the
1289@code{semantic-decoration-on-includes} decoration style.
1290@end deffn
1291
1292@deffn Face semantic-decoration-on-unparsed-includes
1293Face for includes that have not yet been parsed, in the
1294@code{semantic-decoration-on-includes} decoration style.
1295@end deffn
1296
1297@subsection Creating New Decoration Modes
1298
1299You can create new types of decorations using the following function:
1300
1301@defun define-semantic-decoration-style name doc &rest flags
1302Define a new decoration style with @var{name}.
1303@var{doc} is a documentation string describing the decoration style @var{name}.
1304It is appended to auto-generated doc strings.
1305An Optional list of @var{flags} can also be specified. Flags are:
1306 @code{:enabled} <value> - specify the default enabled value for @var{name}.
1307
1308
1309This defines two new overload functions respectively called @code{NAME-p}
1310and @code{NAME-highlight}, for which you must provide a default
1311implementation in respectively the functions @code{NAME-p-default} and
1312@code{NAME-highlight-default}. Those functions are passed a tag. @code{NAME-p}
1313must return non-@code{nil} to indicate that the tag should be decorated by
1314@code{NAME-highlight}.
1315
1316To put primary decorations on a tag @code{NAME-highlight}, use
1317functions like @dfn{semantic-set-tag-face},
1318@dfn{semantic-set-tag-intangible}, etc., found in the
1319semantic-decorate library.
1320
1321To add other kind of decorations on a tag, @code{NAME-highlight} must use
1322@dfn{semantic-decorate-tag}, and other functions of the semantic
1323decoration @var{api} found in this library.
1324@end defun