* Makefile.in: Build the Semantic manual.
[bpt/emacs.git] / doc / misc / sem-user.texi
CommitLineData
3149927d
CY
1@c This file is included by semantic.texi
2
3@c Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
4@c Free Software Foundation, Inc.
5
6@c Permission is granted to copy, distribute and/or modify this
7@c document under the terms of the GNU Free Documentation License,
8@c Version 1.3 or any later version published by the Free Software
9@c Foundation; with no Invariant Sections, no Front-Cover Texts, and
10@c no Back-Cover Texts. A copy of the license is included in the
11@c section entitled ``GNU Free Documentation License''.
12
13You can begin using @semantic{} by enabling Semantic mode, a global
14minor mode: type @kbd{M-x semantic-mode}, or click on the @samp{Source
15Code Parsers (Semantic)} menu item in the @samp{Tools} menu.
16
17When Semantic mode is turned on, Emacs automatically parses each file
18you visit. This allows you to use @semantic{} user commands in those
19buffers. It also enables a number of ``helper'' minor modes for
20saving tags, displaying tag information, and so forth. @xref{Semantic
21mode}.
22
23To enable Semantic mode each time you start Emacs, add the line
24@code{(semantic-mode 1)} to your initialization file. @xref{Init
25File,,,emacs,Emacs manual}.
26
27@menu
28* Semantic mode:: Global minor mode for @semantic{}.
29* SemanticDB:: Caching parsed buffers between sessions.
30* Idle Scheduler:: Performing @semantic{} operations when idle.
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
40@code{semantic-new-buffer-setup-functions} (the default is to parse
41every buffer @semantic{} knows how to parse).
42
43In each parser-enabled buffer, a number of @semantic{} commands are
44available for navigating, querying, and editing source code.
45@xref{Semantic mode user commands}. Enabling Semantic mode also
46installs a @samp{Development} menu on the menu-bar, with many of these
47commands.
48
49In addition, enabling Semantic mode turns on certain auxilliary global
50minor modes, as specified by the variable
51@code{semantic-default-submodes}. The default auxilliary modes are
52SemanticDB mode (@pxref{SemanticDB}) and Global Semantic Idle
53Scheduler mode. You can also toggle the auxilliary minor modes
54separately, using their mode functions (e.g. @kbd{M-x
55semanticdb-minor-mode}), or via the @samp{Development} menu. These
56auxilliary minor modes are described in the following sections.
57
58@defvar semantic-new-buffer-setup-functions
59The value of this variable is an alist of functions to call for
60setting up @semantic{} parsing in the buffer. Each element has the
61form @code{(@var{mode} . @var{fn})}, where @var{mode} is a value of
62@code{major-mode} for the buffer and @var{fn} is the corresponding
63function for setting up the parser. @var{fn} is called, with no
64arguments, after the major mode is initialized (and after the mode
65hooks have been run).
66
67The default value enables @semantic{} for all supported major modes
68(i.e., C, C++, Scheme, Javascript, Java, HTML, SRecode, and Make), but
69you can remove modes from this list if you don't want to use
70@semantic{} with them.
71@end defvar
72
73@defvar semantic-default-submodes
74The value of this variable is a list of symbols, specifying the
75auxilliary minor modes to enable when enabling Semantic mode. The
76valid mode symbols are:
77
78@itemize
79@item @code{semantic-idle-scheduler-mode} (@pxref{Idle Scheduler}).
80@item @code{semanticdb-minor-mode} (@pxref{SemanticDB}).
81@item @code{semantic-idle-summary-mode} (@pxref{Idle Summary Mode}).
82@item @code{semantic-idle-completions-mode} (@pxref{Idle Completions Mode}).
83@item @code{semantic-highlight-func-mode}
84@item @code{semantic-decoration-mode}
85@item @code{semantic-stickyfunc-mode}
86@item @code{semantic-mru-bookmark-mode}
87@end itemize
88@end defvar
89
90@menu
91* Semantic mode user commands::
92@end menu
93
94@node Semantic mode user commands
95@subsection Semantic mode user commands
96
97Semantic mode provides a number of commands for navigating, querying,
98and editing source code in a language-aware manner. These commands
99generally act on @dfn{tags}, which are the source-code units deemed
100``important'' by the present programming language (e.g. functions in
101the C programming language).
102
103These commands may be used in any buffer that has been parsed by
104@semantic{}. Several of them prompt for a tag name using the
105minibuffer; here, the @kbd{TAB} key can be used to complete tag names.
106Others act on the @dfn{current tag}, meaning the tag at (or around)
107point.
108
109@table @kbd
110@item \C-c , j
111Prompt for a tag defined in the current file, and move point to it
112(@code{semantic-complete-jump-local}).
113
114@item \C-c , J
115Prompt for a tag defined in any file that Emacs has parsed, and move
116point to it (@code{semantic-complete-jump}).
117
118@item \C-c , l
119Display a list of the possible completions of the current tag
120(@code{semantic-analyze-possible-completions}).
121
122@item \C-c , g
123Prompt for a tag, and display a list of tags that call it
124(@code{semantic-symref-symbol}).
125
126@item \C-c , G
127Display a list of tags that call the current tag
128(@code{semantic-symref}).
129
130@item \C-c , p
131Move point to the previous tag (@code{senator-previous-tag}).
132
133@item \C-c , n
134Move point to the next tag (@code{senator-next-tag}).
135
136@item \C-c , u
137Move point ``up'' one reference (@code{senator-go-to-up-reference}).
138The meaning of ``up'' is language-dependent; in C++, for instance,
139this means moving to the parent of the current tag.
140
141@item \C-c, @key{SPC}
142(@code{semantic-complete-analyze-inline})
143
144@item \C-c,\C-w
145Kill the current tag (@code{senator-kill-tag}). This removes the text
146for that tag, placing it in the kill ring. You can retrieve the text
147with @kbd{C-y}. This also places the tag in the @dfn{tag ring}, so
148that you can yank it with @kbd{\C-c,\C-y}, below.
149
150@item \C-c,\M-w
151Copy the current tag into the kill ring as well as the tag ring
152(@code{senator-copy-tag}).
153
154@item \C-c,\C-y
155Yank a tag from the tag ring (@code{senator-yank-tag}).
156
157@item \C-c,r
158Copy the current tag into a register
159(@code{senator-copy-tag-to-register}). With an optional argument,
160kill it as well. This allows you to insert or jump to that tag with
161the usual register commands. @xref{Registers,,,emacs,Emacs manual}.
162
163@item ?\C-c , @kbd{up}
164Transpose the current tag with the previous one
165(@code{senator-transpose-tags-up}).
166
167@item ?\C-c ?, @kbd{down}
168Transpose the current tag with the next one
169(@code{senator-transpose-tags-down}).
170@end table
171
172@node SemanticDB
173@section Semantic Database
174@cindex SemanticDB
175
176The Semantic Database (SemanticDB) caches the results of parsing
177source code files. This data can be saved to disk when you exit
178Emacs, and reloaded automatically when you subsequently revisit the
179same source code files. This saves time by eliminating the need to
180re-parse unmodified files.
181
182SemanticDB also provides an @acronym{API} that programs can use to
183acquire information about source code tags. This information can be
184accessed without loading the original the source files into memory.
185It can also be used to create alternate ``back-ends'' for storing tag
186information in alternative on-disk formats.
187
188By default, SemanticDB is enabled together with Semantic mode. To
189disable it, remove it from @code{semantic-default-submodes}
190(@pxref{Semantic mode}). You can also enable or disable SemanticDB
191with @kbd{M-x global-semanticdb-minor-mode}.
192
193@deffn Command global-semanticdb-minor-mode
194Toggle SemanticDB mode. When enabled, any source code parsed by
195@semantic{} is cached in a database.
196@end deffn
197
198SemanticDB offers a large number of customizable options, which are
199described in the following subsections.
200
201@menu
202* Semanticdb Tag Storage::
203* Semanticdb Search Configuration::
204* Changing Backends::
205* Script Generated Cache Files::
206* Create System Databases::
207@end menu
208
209@node Semanticdb Tag Storage
210@subsection Semanticdb Tag Storage
211
212Each time you exit Emacs, any data cached by SemanticDB is saved in
213the directory @file{.emacs.d/semanticdb/}, located in your home
214directory. Within this directory, the cache data is written into a
215set of files according to a SemanticDB-specific filename convention.
216If the SemanticDB directory does not exist, Emacs first asks if you
217want to create it.
218
219You can change the name of the SemanticDB directory by customizing the
220variable @code{semanticdb-default-save-directory}.
221
222@anchor{semanticdb-default-save-directory}
223@deffn Option semanticdb-default-save-directory
224The name of the directory where SemanticDB cache files are saved. If
225the value is @code{nil}, SemanticDB saves its data into a single file,
226in the current directory, whose filename is given by
227@code{semanticdb-default-file-name}.
228@end deffn
229
230@anchor{semanticdb-default-file-name}
231@deffn Option semanticdb-default-file-name
232The name of a cache file in which to save SemanticDB, when
233@code{semanticdb-default-save-directory} is @code{nil}.
234@end deffn
235
236You can force SemanticDB to save the data from only certain files, or
237suppress saving altogether, by customizing
238@code{semanticdb-persistent-path}:
239
240@anchor{semanticdb-persistent-path}
241@deffn Option semanticdb-persistent-path
242List of valid paths for SemanticDB to cache. Each element should be a
243directory name (a string); then the parse data from any file in that
244directory is saved.
245
246As a special exception, the value of this variable can be a list
247containing a single symbol: @code{never}, @code{always}, or
248@code{project}. The symbol @code{never} disables saving anywhere;
249@code{always} enables saving everywhere; and @code{project} enables
250saving directory based on the variable
251@code{semanticdb-project-predicate-functions}.
252
253The default value is @code{(always)}.
254@end deffn
255
256@anchor{semanticdb-project-predicate-functions}
257@defvar semanticdb-project-predicate-functions
258The value of this variable is a list of predicates for indicating that
259a directory belongs to a project. This list is used when the value of
260@code{semanticdb-persistent-path} is @code{(project)}. If the list is
261empty, all paths are considered valid.
262
263Project management packages, such as EDE (@pxref{Top,,,ede,EDE
264manual}), may add their own predicates with @dfn{add-hook} to this
265variable. This allows SemanticDB to save tag caches in directories
266controlled by them.
267@end defvar
268
269@anchor{semanticdb-save-database-hooks}
270@deffn Option semanticdb-save-database-hooks
271Abnormal hook run after a database is saved. Each function is called
272with one argument, the object representing the database recently
273written.
274@end deffn
275
276@node Semanticdb Search Configuration
277@subsection Semanticdb Search Configuration
278
279 When another part of @semantic{} (or another Emacs package using
280@semantic{}) searches for a tag within SemanticDB, the SemanticDB
281library may perform a search in the locations of the database:
282
283@enumerate
284@item
285The entries defined by the current file.
286@item
287The entries defined by the @dfn{include files} of the current file.
288@item
289The entries defined by the include files included from the include
290files (and so on, recursively).
291@end enumerate
292
293In C and C++, for instance, include files are defined with the
294@samp{#include} preprocessor directive (SemanticDB tries to
295distinguish between project and system headers, based on the @code{""}
296and @code{<>} filename delimiters). Include directives are matched to
297filenames in the SemanticDB cache using the following criteria:
298
299@enumerate
300@item
301Whether the file is in the same directory as the current file
302@item
303Whether the file is in the same project, as defined by EDE
304(@pxref{Top,,,ede,EDE manual}) or the @code{semanticdb-project-roots}
305variable (@pxref{Semanticdb Roots}).
306@item
307Whether the file is in the @dfn{system include path} (@pxref{Include
308paths}).
309@end enumerate
310
311@menu
312* Semanticdb Roots:: Specifying the root of different projects
313* Include paths:: Add/Remove directories to include search paths
314* Search Throttle:: Controlling how semanticdb searches occur
315* Semanticdb search debugging commands::
316@end menu
317
318@node Semanticdb Roots
319@subsubsection SemanticDB project roots
320
321Project roots are the ``top-level'' directories for a single code
322project. With the exception of system directories, SemanticDB
323searches are usually limited to the current single code project.
324Therefore, it is helpful to specify the project root if you want
325@semantic{} tag searches to work correctly.
326
327@anchor{semanticdb-project-roots}
328@deffn Option semanticdb-project-roots
329The value of this variable is a list of directories (strings) that are
330project root. All subdirectories of a project root are considered
331part of the same project. This variable can be overriden by project
332management programs via @code{semanticdb-project-root-functions}.
333@end deffn
334
335@anchor{semanticdb-project-root-functions}
336@defvar semanticdb-project-root-functions
337The value of this variable is a list of functions to determine a given
338directory's project root. These functions are called, one at a time,
339with one argument (the directory name), and must return either
340@code{nil}, a string (the project root), or a list of strings
341(multiple project roots, for complex systems). The first
342non-@code{nil} return value, if any, is taken to be the project root,
343overriding @code{semanticdb-project-roots}.
344@end defvar
345
346If you use EDE for project management, it will set
347@code{semanticdb-project-root-functions} automatically.
348@xref{Top,,,ede,EDE manual}.
349
350@node Include paths
351@subsubsection Include Paths
352
353System include paths are standard locations to find source code tags,
354such as the @dfn{header files} in @file{/usr/include} and its
355subdirectories on Unix-like operating systems. You can add and remove
356system include paths using the following commands:
357
358@anchor{semantic-add-system-include}
359@deffn Command semantic-add-system-include dir &optional mode
360This command prompts for a directory, @var{dir}, and adds it as a
361system include path for the current major mode. When called
362non-interactively, the major mode can be specified with the @var{mode}
363argument.
364@end deffn
365
366@anchor{semantic-remove-system-include}
367@deffn Command semantic-remove-system-include dir &optional mode
368This command prompt for a directory, @var{dir}, and removes it from
369the system include path for the current major mode (or @var{mode}).
370@end deffn
371
372@anchor{semantic-customize-system-include-path}
373@deffn Command semantic-customize-system-include-path &optional mode
374Customize the system include path for the current major mode (or
375@code{mode}).
376@end deffn
377
378@anchor{semanticdb-implied-include-tags}
379@defun semanticdb-implied-include-tags
380Include tags implied for all files of a given mode. You can set this
381variable with @code{defvar-mode-local} for a particular mode so that
382any symbols that exist for all files for that mode are included.
383@end defun
384
385@c @xref{Search Optimization}, for more information on include paths.
386
387@node Search Throttle
388@subsubsection SemanticDB Search Throttle
389
390The SemanticDB search throttle is a variable that may be configured by
391a language support author. If you need to customize this for
392yourself, you may need to override the mode values in a mode support
393hook.
394
395@defvar semanticdb-find-default-throttle
396@anchor{semanticdb-find-default-throttle}
397The default throttle for @code{semanticdb-find} routines.
398The throttle controls how detailed the list of database
399tables is for a symbol lookup. The value is a list with
400the following keys:
401
402@table @code
403@item file
404The file the search is being performed from. This option is here for
405completeness only, and is assumed to always be on.
406@item local
407Tables from the same local directory are included. This includes
408files directly referenced by a file name which might be in a different
409directory.
410@item project
411Tables from the same local project are included If @code{project} is
412specified, then @code{local} is assumed.
413@item unloaded
414If a table is not in memory, load it. If it is not cached on disk
415either, get the source, parse it, and create the table.
416@item system
417Tables from system databases. These are specifically tables
418from system header files, or language equivalent.
419@item recursive
420For include based searches, includes tables referenced by included
421files.
422@item omniscience
423Included system databases which are omniscience, or somehow know
424everything. Omniscience databases are found in
425@code{semanticdb-project-system-databases}. The Emacs Lisp system
426@var{db} is an omniscience database.
427@end table
428
429@end defvar
430
431To set the throttle, use a command like this:
432
433@example
434(setq-mode-local c-mode
435 semanticdb-find-default-throttle
436 '(project unloaded system recursive))
437@end example
438
439The default value of the throttle is for maximum accuracy at the
440expense of time taken to perform a particular look-up. The throttle
441is tweaked by @code{semantic-idle-summary-mode} to remove 'unloaded,
442thus removing poor speed at unexpected times.
443
444@node Semanticdb search debugging commands
445@subsubsection Semanticdb search debugging commands
446
447You can use @kbd{M-x semanticdb-dump-all-table-summary RET} to see the
448list of databases that will be searched from a given buffer. It
449should include DBs for the directories you expect. You can follow up
450with @kbd{M-x semanticdb-find-test-translate-path RET} to then make
451sure specific tables from the path are discovered correctly.
452
453Alternately, you can get a list of include files @semantic{}
454encountered, but could not find on disk using
455@kbd{M-x semanticdb-find-adebug-lost-includes RET}.
456
457Once you have used the below functions to debug the problem, you may
458need to reconfigure how @semantic{} finds include files.
459See @ref{Semanticdb Search Configuration}. If the search config is
460ok, you may need to configure the search throttle. See @ref{Search Throttle}.
461
462@deffn Command semanticdb-dump-all-table-summary
463@anchor{semanticdb-dump-all-table-summary}
464Dump a list of all databases in Emacs memory.
465@end deffn
466
467@deffn Command semanticdb-find-test-translate-path &optional arg
468@anchor{semanticdb-find-test-translate-path}
469Call and output results of @dfn{semanticdb-find-translate-path}
470With @var{arg} non-@code{nil}, specify a @var{brutish} translation.
471@end deffn
472
473@deffn Command semanticdb-find-adebug-lost-includes
474@anchor{semanticdb-find-adebug-lost-includes}
475Translate the current path, then display the lost includes.
476Examines the variable @code{semanticdb-find-lost-includes}.
477@end deffn
478
479Lastly, you can test an explicit search term using this command:
480
481@deffn Command semantic-adebug-searchdb regex
482@anchor{semantic-adebug-searchdb}
483Search the semanticdb for @var{regex} for the current buffer.
484Display the results as a debug list.
485@end deffn
486
487@node Changing Backends
488@subsection Changing Backends
489
490If you want to use some other form of backend, you can use this
491variable to choose which back end class to use for your general tag
492storage.
493
494The default is to save databases in flat files. Alternatively, you
495could write a new database backend that stores tags into a database,
496or other storage system.
497
498@defvar semanticdb-new-database-class
499@anchor{semanticdb-new-database-class}
500The default type of database created for new files.
501This can be changed on a per file basis, so that some directories
502are saved using one mechanism, and some directories via a different
503mechanism.
504@end defvar
505
506@node Script Generated Cache Files
507@subsection Script Generated Cache Files
508
509You can create new semantic databases with the @file{semanticdb.sh}
510script file. Give this script the directory you want parsed, and it
511will create a cache file for you.
512
513@example
514$ semanticdb.sh *.el
515@end example
516
517To use these generated tables, you would likely need to restart Emacs.
518
519@node Create System Databases
520@subsection Create System Databases
521
522If your supported language stores the system libraries in readily
523available parsable source code, you can pre-generate database files
524for them once, which will be used over and over for tools such as
525summary-mode, or the analyzer.
526
527@deffn Command semanticdb-create-ebrowse-database dir
528@anchor{semanticdb-create-ebrowse-database}
529Create an @var{ebrowse} database for directory @var{dir}.
530The database file is stored in ~/.semanticdb, or whichever directory
531is specified by @code{semanticdb-default-system-save-directory}.
532@end deffn
533
534
535@node Idle Scheduler
536@section Idle Scheduler
537@cindex Idle Scheduler
538
539The Idle Scheduler in @semantic{} performs multiple duties.
540
541The primary job is to schedule buffer parsing in idle time. The
542first buffer whose cache is checked is the current buffer. After
543this, all other buffers are checked.
544
545Once that has been accomplished, scheduled idle processes that use the
546semantic tag tables are run.
547
548@deffn Command global-semantic-idle-scheduler-mode &optional arg
549@anchor{global-semantic-idle-scheduler-mode}
550Toggle global use of option @dfn{semantic-idle-scheduler-mode}.
551The idle scheduler with automatically reparse buffers in idle time,
552and then schedule other jobs setup with @dfn{semantic-idle-scheduler-add}.
553If @var{ARG} is positive, enable, if it is negative, disable.
554If @var{ARG} is @code{nil}, then toggle.
555@obsolete{global-semantic-auto-parse-mode,global-semantic-idle-scheduler-mode}
556@end deffn
557
558@obsolete{semantic-auto-parse-mode, semantic-idle-scheduler-mode}
559
560@deffn Option semantic-idle-scheduler-idle-time
561@anchor{semantic-idle-scheduler-idle-time}
562Time in seconds of idle before scheduling events.
563This time should be short enough to ensure that idle-scheduler will be
564run as soon as Emacs is idle.
565@end deffn
566
567@deffn Option semantic-idle-scheduler-mode-hook
568@anchor{semantic-idle-scheduler-mode-hook}
569Hook run at the end of function @dfn{semantic-idle-scheduler-mode}.
570@end deffn
571
572@deffn Option semantic-idle-scheduler-verbose-flag
573@anchor{semantic-idle-scheduler-verbose-flag}
574Non-@code{nil} means that the idle scheduler should provide debug messages.
575Use this setting to debug idle activities.
576@end deffn
577
578You can add new functionality to the idle scheduler by reading the
579Application Developers Guide
580@inforef{Idle Scheduling, , semantic-appdev.info}.
581
582@menu
583* Reparsing Options:: Reparsing the current buffer in idle time
584* Idle Working Options:: Options for extra work done at idle time
585* Debugging Idle Time Issues:: How to produce good bug reports.
586* Idle Summary Mode:: Display prototype of symbol under cursor
587* Idle Completions Mode:: Smart completion pop-up help.
588@end menu
589
590@node Reparsing Options
591@subsection Reparsing Options
592
593The Idle Scheduler will automatically reparse all buffers that need
594it. User input at any time will cancel the operations and return to
595normal editing.
596
597@deffn Option semantic-idle-scheduler-max-buffer-size
598@anchor{semantic-idle-scheduler-max-buffer-size}
599Maximum size in bytes of buffers automatically reparsed.
600If this value is less than or equal to @var{0}, buffers are automatically
601reparsed regardless of their size.
602@end deffn
603
604@deffn Option semantic-idle-scheduler-no-working-message
605@anchor{semantic-idle-scheduler-no-working-message}
606If non-@code{nil}, disable display of working messages during parse.
607@end deffn
608
609@deffn Option semantic-idle-scheduler-working-in-modeline-flag
610@anchor{semantic-idle-scheduler-working-in-modeline-flag}
611Non-@code{nil} means show working messages in the mode line.
612Typically, parsing will show messages in the minibuffer.
613This will move the parse message into the modeline.
614@end deffn
615
616@defvar semantic-before-idle-scheduler-reparse-hooks
617@anchor{semantic-before-idle-scheduler-reparse-hooks}
618Hooks run before option @code{semantic-idle-scheduler} begins parsing.
619If any hook throws an error, this variable is reset to nil.
620This hook is not protected from lexical errors.
621@end defvar
622
623@defvar semantic-after-idle-scheduler-reparse-hooks
624@anchor{semantic-after-idle-scheduler-reparse-hooks}
625Hooks run after option @code{semantic-idle-scheduler} has parsed.
626If any hook throws an error, this variable is reset to nil.
627This hook is not protected from lexical errors.
628@end defvar
629
630@node Idle Working Options
631@subsection Idle Working Options
632
633Similiar to the reparsing that occurs at short intervals in idle
634time, there is extra work that can be controlled to occur in idle time
635also.
636
637Idle work occurs after a longer delay, and can be very time
638consuming. The work done includes:
639
640@table @asis
641@item Create Include Path Caches
642Create the optimized search caches needed for symbol lookup.
643@item Create Type Cache
644Create the datatype caches needed for intellisense features.
645@item Save Databases
646All file-based @semantic{} databases are saved to disk.
647@item Parse neighboring files
648All files in the same directory as the current buffer are
649speculatively parsed.
650@end table
651
652These features can be controlled with the following variables:
653
654@deffn Option semantic-idle-scheduler-work-idle-time
655@anchor{semantic-idle-scheduler-work-idle-time}
656Time in seconds of idle before scheduling big work.
657This time should be long enough that once any big work is started, it is
658unlikely the user would be ready to type again right away.
659@end deffn
660
661@deffn Option semantic-idle-work-parse-neighboring-files-flag
662@anchor{semantic-idle-work-parse-neighboring-files-flag}
663Non-@code{nil} means to parse files in the same dir as the current buffer.
664Disable to prevent lots of excessive parsing in idle time.
665@end deffn
666
667@node Debugging Idle Time Issues
668@subsection Debugging Idle Time Issues
669
670If you see errors produced in idle time, it could be an indication of a
671more serious issue elsewhere. It is not enough to enable
672@code{debug-on-error}, as the idle timer tries to keep errors under
673wraps.
674
675Instead, there are two commands you can use whenever you see an idle
676error.
677
678@deffn Command semantic-debug-idle-function
679@anchor{semantic-debug-idle-function}
680Run the Semantic idle function with debugging turned on.
681@end deffn
682
683@deffn Command semantic-debug-idle-work-function
684@anchor{semantic-debug-idle-work-function}
685Run the Semantic idle work function with debugging turned on.
686@end deffn
687
688Once you identify the general location of the idle error, you can send
689the stack trace to the mailing list, or perhaps find a more focused
690way to reproduce the issue.
691
692@node Idle Summary Mode
693@subsection Idle Summary Mode
694
695Similar to the Emacs Lisp facility eldoc,
696@code{semantic-idle-summary-mode} will display the prototype, or other
697helpful doc about the symbol currently under point.
698
699
700@deffn semantic-idle-summary-mode &optional arg
701@anchor{semantic-idle-summary-mode}
702Display a tag summary of the lexical token under the cursor.
703This means for getting the current tag to display information can
704be overriden with @code{idle-summary-current-symbol-info}.
705This is a minor mode which performs actions during idle time.
706With prefix argument ARG, turn on if positive, otherwise off. The
707minor mode can be turned on only if semantic feature is available and
708the current buffer was set up for parsing. Return non-nil if the
709minor mode is enabled
710@end deffn
711
712@obsolete{semantic-summary-mode, semantic-idle-summary-mode}
713
714@deffn Option semantic-idle-summary-function
715@anchor{semantic-idle-summary-function}
716Function to use when displaying tag information during idle time.
717Some useful functions are found in @code{semantic-format-tag-functions}.
718@end deffn
719
720@defvar semantic-idle-summary-out-of-context-faces
721@anchor{semantic-idle-summary-out-of-context-faces}
722List of font-lock faces that indicate a useless summary context.
723Those are generally faces used to highlight comments or strings.
724
725It might be useful to override this variable to add comment faces
726specific to a major mode. For example, in jde mode:
727
728@example
729(defvar-mode-local jde-mode semantic-idle-summary-out-of-context-faces
730 (append (default-value 'semantic-idle-summary-out-of-context-faces)
731 '(jde-java-font-lock-doc-tag-face
732 jde-java-font-lock-link-face
733 jde-java-font-lock-bold-face
734 jde-java-font-lock-underline-face
735 jde-java-font-lock-pre-face
736 jde-java-font-lock-code-face)))
737@end example
738
739@end defvar
740
741@node Idle Completions Mode
742@subsection Idle Completions Mode
743
744The definition of smart completion is described in the Analyzer
745section @ref{Analyzer}.
746
747The Idle Completions mode will calculate the list of possible
748completions in idle time, and display them in a popup list, or other
749inline completion mechanism.
750
751@deffn semantic-idle-completions-mode &optional arg
752@anchor{semantic-idle-completions-mode}
753Display a tooltip with a list of possible completions near the cursor.
754There is no convenience for performing a completion replacement. For
755that you should bind @code{semantic-ia-complete-symbol}.
756This is a minor mode which performs actions during idle time.
757With prefix argument ARG, turn on if positive, otherwise off. The
758minor mode can be turned on only if semantic feature is available and
759the current buffer was set up for parsing. Return non-nil if the
760minor mode is enabled
761@end deffn
762
763This mode operates by using the command
764@code{semantic-complete-inline-analyzer}.
765
766Idle completion uses the completion function
767@code{semantic-complete-analyze-inline-idle}. Changing the behavior of
768the idle completion popups should be done through those utilities.
769
770@deffn Command semantic-complete-analyze-inline-idle
771@anchor{semantic-complete-analyze-inline-idle}
772Perform prompt completion to do in buffer completion.
773@dfn{semantic-analyze-possible-completions} is used to determine the
774possible values.
775The function returns immediately, leaving the buffer in a mode that
776will perform the completion.
777Configure @code{semantic-complete-inline-analyzer-idle-displayor-class}
778to change how completion options are displayed.
779@end deffn
780
781@deffn Option semantic-complete-inline-analyzer-idle-displayor-class
782@anchor{semantic-complete-inline-analyzer-idle-displayor-class}
783Class for displayor to use with inline completion at idle time.
784
785Customize this variable to get a list of options, such as popup
786tooltips, ghosting text, or traditional completion tools.
787@end deffn