aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2009-11-20 01:52:41 +0000
committerChong Yidong2009-11-20 01:52:41 +0000
commitbd6f6833522a44610e9075efb97322bdc44765bf (patch)
tree5166e17959c4d9af1ce726713dd7f693e17805da
parent725bff063ec5e973b0c5492d4130d5c335748839 (diff)
downloademacs-bd6f6833522a44610e9075efb97322bdc44765bf.tar.gz
emacs-bd6f6833522a44610e9075efb97322bdc44765bf.zip
* sem-user.texi (Semanticdb Search Configuration): Rearrange nodes.
(Search Throttle, Semanticdb Roots, Include paths, Idle Scheduler): Numerous copyedits.
-rw-r--r--doc/misc/ChangeLog6
-rw-r--r--doc/misc/sem-user.texi350
2 files changed, 157 insertions, 199 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index f95f251d08e..cffce1a6996 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,9 @@
12009-11-20 Chong Yidong <cyd@stupidchicken.com>
2
3 * sem-user.texi (Semanticdb Search Configuration): Rearrange nodes.
4 (Search Throttle, Semanticdb Roots, Include paths, Idle Scheduler):
5 Numerous copyedits.
6
12009-11-17 Juanma Barranquero <lekktu@gmail.com> 72009-11-17 Juanma Barranquero <lekktu@gmail.com>
2 8
3 * semantic.texi (Semantic Internals, Glossary): 9 * semantic.texi (Semantic Internals, Glossary):
diff --git a/doc/misc/sem-user.texi b/doc/misc/sem-user.texi
index dd8f23c2e4f..38bb1d6982e 100644
--- a/doc/misc/sem-user.texi
+++ b/doc/misc/sem-user.texi
@@ -202,7 +202,6 @@ described in the following subsections.
202* Semanticdb Tag Storage:: 202* Semanticdb Tag Storage::
203* Semanticdb Search Configuration:: 203* Semanticdb Search Configuration::
204* Changing Backends:: 204* Changing Backends::
205* Script Generated Cache Files::
206* Create System Databases:: 205* Create System Databases::
207@end menu 206@end menu
208 207
@@ -277,59 +276,105 @@ written.
277@subsection Semanticdb Search Configuration 276@subsection Semanticdb Search Configuration
278 277
279 When another part of @semantic{} (or another Emacs package using 278 When another part of @semantic{} (or another Emacs package using
280@semantic{}) searches for a tag within SemanticDB, the SemanticDB 279@semantic{}) queries the SemanticDB library for a source code tag, the
281library may perform a search in the locations of the database: 280search need not be limited to tags defined within the current file.
282 281It can include tags defined elsewhere, such as @dfn{header files}
283@enumerate 282referenced by the current file (e.g., via the C/C++ @code{#include}
284@item 283directive). While performing the search, the SemanticDB library may
285The entries defined by the current file. 284even automatically visit other files and parse them, if necessary.
286@item 285
287The entries defined by the @dfn{include files} of the current file. 286 The variable @code{semanticdb-find-default-throttle} determines how
288@item 287aggressively SemanticDB searches for source code tags. @xref{Search
289The entries defined by the include files included from the include 288Throttle}.
290files (and so on, recursively). 289
291@end enumerate 290 The details of SemanticDB searches can vary from language to
292 291language. In C/C++ code, for example, SemanticDB distinguishes
293In C and C++, for instance, include files are defined with the 292between @dfn{project header files} and @dfn{system header files},
294@samp{#include} preprocessor directive (SemanticDB tries to 293based on whether the @code{#include} directive uses the @code{""} or
295distinguish between project and system headers, based on the @code{""} 294@code{<>} filename delimiter. SemanticDB looks for system header in
296and @code{<>} filename delimiters). Include directives are matched to 295the @dfn{system include path} (@pxref{Include paths}).
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 296
311@menu 297@menu
298* Search Throttle:: Controlling how semanticdb searches occur
312* Semanticdb Roots:: Specifying the root of different projects 299* Semanticdb Roots:: Specifying the root of different projects
313* Include paths:: Add/Remove directories to include search paths 300* Include paths:: Add/Remove directories to include search paths
314* Search Throttle:: Controlling how semanticdb searches occur
315* Semanticdb search debugging commands:: 301* Semanticdb search debugging commands::
316@end menu 302@end menu
317 303
304@node Search Throttle
305@subsubsection SemanticDB Search Throttle
306
307The SemanticDB @dfn{search throttle} determines how aggressive
308SemanticDB searches are. It is controlled by the variable
309@code{semanticdb-find-default-throttle}. The default value of this
310variable aims for maximum accuracy, at the expense of search time.
311
312Other parts of the @semantic{} package, particularly the different
313language parsers, may change the value of
314@code{semanticdb-find-default-throttle}. You can override its value,
315for a given major mode, like this:
316
317@example
318(setq-mode-local c-mode
319 semanticdb-find-default-throttle
320 '(project unloaded system recursive))
321@end example
322
323@anchor{semanticdb-find-default-throttle}
324@defvar semanticdb-find-default-throttle
325The default throttle for @code{semanticdb-find} routines.
326The throttle controls how detailed the list of database
327tables is for a symbol lookup. The value is a list with
328the following keys:
329
330@table @code
331@item file
332The file the search is being performed from. This option is here for
333completeness only, and is assumed to always be on.
334@item local
335Tables from the same local directory are included. This includes
336files directly referenced by a file name which might be in a different
337directory.
338@item project
339Tables from the same local project are included If @code{project} is
340specified, then @code{local} is assumed.
341@item unloaded
342If a table is not in memory, load it. If it is not cached on disk
343either, get the source, parse it, and create the table.
344@item system
345Tables from system databases. These are specifically tables
346from system header files, or language equivalent.
347@item recursive
348For include based searches, includes tables referenced by included
349files.
350@item omniscience
351Included system databases which are omniscience, or somehow know
352everything. Omniscience databases are found in
353@code{semanticdb-project-system-databases}. The Emacs Lisp system
354@var{db} is an omniscience database.
355@end table
356@end defvar
357
318@node Semanticdb Roots 358@node Semanticdb Roots
319@subsubsection SemanticDB project roots 359@subsubsection SemanticDB project roots
320 360
321Project roots are the ``top-level'' directories for a single code 361The @code{project} setting in the SemanticDB search throttle
322project. With the exception of system directories, SemanticDB 362(@pxref{Search Throttle}) tells SemanticDB to search within the
323searches are usually limited to the current single code project. 363current single code project. For @semantic{}'s point of view,
324Therefore, it is helpful to specify the project root if you want 364@dfn{projects} are determined by their top-level directories, or
325@semantic{} tag searches to work correctly. 365@dfn{project roots}; every subdirectory of a project root is
366considered part of the same project.
367
368If you use EDE for project management, it will set the project roots
369automatically. @xref{Top,,,ede,EDE manual}. You can also specify
370them yourself.
326 371
327@anchor{semanticdb-project-roots} 372@anchor{semanticdb-project-roots}
328@deffn Option semanticdb-project-roots 373@deffn Option semanticdb-project-roots
329The value of this variable is a list of directories (strings) that are 374The value of this variable is a list of directories (strings) that are
330project root. All subdirectories of a project root are considered 375project roots. All subdirectories of a project root are considered
331part of the same project. This variable can be overriden by project 376part of the same project. This variable can be overriden by
332management programs via @code{semanticdb-project-root-functions}. 377@code{semanticdb-project-root-functions}.
333@end deffn 378@end deffn
334 379
335@anchor{semanticdb-project-root-functions} 380@anchor{semanticdb-project-root-functions}
@@ -343,30 +388,27 @@ non-@code{nil} return value, if any, is taken to be the project root,
343overriding @code{semanticdb-project-roots}. 388overriding @code{semanticdb-project-roots}.
344@end defvar 389@end defvar
345 390
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 391@node Include paths
351@subsubsection Include Paths 392@subsubsection Include Paths
352 393
353System include paths are standard locations to find source code tags, 394System include paths are standard locations to find source code tags,
354such as the @dfn{header files} in @file{/usr/include} and its 395such as the @dfn{header files} in @file{/usr/include} and its
355subdirectories on Unix-like operating systems. You can add and remove 396subdirectories on Unix-like operating systems.
356system include paths using the following commands: 397
398You can add and remove system include paths using the following
399commands:
357 400
358@anchor{semantic-add-system-include} 401@anchor{semantic-add-system-include}
359@deffn Command semantic-add-system-include dir &optional mode 402@deffn Command semantic-add-system-include dir &optional mode
360This command prompts for a directory, @var{dir}, and adds it as a 403Prompts for a directory, @var{dir}, and add it as a system include
361system include path for the current major mode. When called 404path for the current major mode. When called non-interactively, the
362non-interactively, the major mode can be specified with the @var{mode} 405major mode can be specified with the @var{mode} argument.
363argument.
364@end deffn 406@end deffn
365 407
366@anchor{semantic-remove-system-include} 408@anchor{semantic-remove-system-include}
367@deffn Command semantic-remove-system-include dir &optional mode 409@deffn Command semantic-remove-system-include dir &optional mode
368This command prompt for a directory, @var{dir}, and removes it from 410Prompt for a directory, @var{dir}, and remove it from the system
369the system include path for the current major mode (or @var{mode}). 411include path for the current major mode (or @var{mode}).
370@end deffn 412@end deffn
371 413
372@anchor{semantic-customize-system-include-path} 414@anchor{semantic-customize-system-include-path}
@@ -384,80 +426,17 @@ any symbols that exist for all files for that mode are included.
384 426
385@c @xref{Search Optimization}, for more information on include paths. 427@c @xref{Search Optimization}, for more information on include paths.
386 428
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 429@node Semanticdb search debugging commands
445@subsubsection Semanticdb search debugging commands 430@subsubsection Semanticdb search debugging commands
446 431
447You can use @kbd{M-x semanticdb-dump-all-table-summary RET} to see the 432You can use @kbd{M-x semanticdb-dump-all-table-summary} to see the
448list of databases that will be searched from a given buffer. It 433list of databases that will be searched from a given buffer. You can
449should include DBs for the directories you expect. You can follow up 434follow up with @kbd{M-x semanticdb-find-test-translate-path} to then
450with @kbd{M-x semanticdb-find-test-translate-path RET} to then make 435make sure specific tables from the path are discovered correctly.
451sure specific tables from the path are discovered correctly.
452 436
453Alternately, you can get a list of include files @semantic{} 437Alternately, you can get a list of include files @semantic{}
454encountered, but could not find on disk using 438encountered, but could not find on disk using @kbd{M-x
455@kbd{M-x semanticdb-find-adebug-lost-includes RET}. 439semanticdb-find-adebug-lost-includes}.
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 440
462@deffn Command semanticdb-dump-all-table-summary 441@deffn Command semanticdb-dump-all-table-summary
463@anchor{semanticdb-dump-all-table-summary} 442@anchor{semanticdb-dump-all-table-summary}
@@ -495,27 +474,13 @@ The default is to save databases in flat files. Alternatively, you
495could write a new database backend that stores tags into a database, 474could write a new database backend that stores tags into a database,
496or other storage system. 475or other storage system.
497 476
498@defvar semanticdb-new-database-class
499@anchor{semanticdb-new-database-class} 477@anchor{semanticdb-new-database-class}
500The default type of database created for new files. 478@defvar semanticdb-new-database-class
501This can be changed on a per file basis, so that some directories 479The default type of database created for new files. This can be
502are saved using one mechanism, and some directories via a different 480changed on a per file basis, so that some directories are saved using
503mechanism. 481one mechanism, and some directories via a different mechanism.
504@end defvar 482@end defvar
505 483
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 484@node Create System Databases
520@subsection Create System Databases 485@subsection Create System Databases
521 486
@@ -531,99 +496,86 @@ The database file is stored in ~/.semanticdb, or whichever directory
531is specified by @code{semanticdb-default-system-save-directory}. 496is specified by @code{semanticdb-default-system-save-directory}.
532@end deffn 497@end deffn
533 498
534
535@node Idle Scheduler 499@node Idle Scheduler
536@section Idle Scheduler 500@section Idle Scheduler
537@cindex Idle Scheduler 501@cindex Idle Scheduler
538 502
539The Idle Scheduler in @semantic{} performs multiple duties. 503The @dfn{Semantic idle scheduler} is a part of @semantic{} that
504performs various operations while Emacs is waiting for user input
505(idle time). Its primary job is to perform buffer parsing, but it is
506also used for other purposes, such as displaying information about
507tags.
540 508
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} 509@anchor{global-semantic-idle-scheduler-mode}
550Toggle global use of option @dfn{semantic-idle-scheduler-mode}. 510@deffn Command global-semantic-idle-scheduler-mode &optional arg
551The idle scheduler with automatically reparse buffers in idle time, 511This command toggles Semantic Idle Scheduler mode in every
552and then schedule other jobs setup with @dfn{semantic-idle-scheduler-add}. 512@semantic{}-enabled buffer. This minor mode ensures that the buffer
553If @var{ARG} is positive, enable, if it is negative, disable. 513is automatically reparsed whenever Emacs is idle. If there is
554If @var{ARG} is @code{nil}, then toggle. 514additional idle time, it runs jobs scheduled by other parts of
555@obsolete{global-semantic-auto-parse-mode,global-semantic-idle-scheduler-mode} 515@semantic{}, such as Semantic Idle Summary mode (@pxref{Idle Summary
516Mode}) and Semantic Idle Completions mode (@pxref{Idle Completions
517Mode}).
556@end deffn 518@end deffn
557 519
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} 520@anchor{semantic-idle-scheduler-idle-time}
562Time in seconds of idle before scheduling events. 521@deffn Option semantic-idle-scheduler-idle-time
563This time should be short enough to ensure that idle-scheduler will be 522The value of this variable is the amount of idle time, in seconds,
564run as soon as Emacs is idle. 523before the Semantic idle scheduler activates. The default is 1.
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 524@end deffn
571 525
572@deffn Option semantic-idle-scheduler-verbose-flag
573@anchor{semantic-idle-scheduler-verbose-flag} 526@anchor{semantic-idle-scheduler-verbose-flag}
574Non-@code{nil} means that the idle scheduler should provide debug messages. 527@deffn Option semantic-idle-scheduler-verbose-flag
575Use this setting to debug idle activities. 528If this variable is non-@code{nil}, the idle scheduler prints verbose
529messages while running, which are useful for debugging.
576@end deffn 530@end deffn
577 531
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 532@menu
583* Reparsing Options:: Reparsing the current buffer in idle time 533* Reparsing Options:: Reparsing the current buffer in idle time
584* Idle Working Options:: Options for extra work done at idle time 534* Idle Working Options:: Options for extra work done at idle time
585* Debugging Idle Time Issues:: How to produce good bug reports 535* Debugging Idle Time Issues:: How to produce good bug reports
586* Idle Summary Mode:: Display prototype of symbol under cursor 536* Idle Summary Mode:: Display prototype of symbol under cursor
587* Idle Completions Mode:: Smart completion pop-up help 537* Idle Completions Mode:: Smart completion pop-up help
588@end menu 538@end menu
589 539
590@node Reparsing Options 540@node Reparsing Options
591@subsection Reparsing Options 541@subsection Reparsing Options
592 542
593The Idle Scheduler will automatically reparse all buffers that need 543When activated during idle time, the Semantic idle scheduler
594it. User input at any time will cancel the operations and return to 544automatically reparses all buffers that need it. Any arriving user
595normal editing. 545input cancels this, returning Emacs to its normal editing behavior.
596 546
597@deffn Option semantic-idle-scheduler-max-buffer-size
598@anchor{semantic-idle-scheduler-max-buffer-size} 547@anchor{semantic-idle-scheduler-max-buffer-size}
599Maximum size in bytes of buffers automatically reparsed. 548@deffn Option semantic-idle-scheduler-max-buffer-size
600If this value is less than or equal to @var{0}, buffers are automatically 549Maximum size in bytes of buffers automatically reparsed. If this
550value is less than or equal to @var{0}, buffers are automatically
601reparsed regardless of their size. 551reparsed regardless of their size.
602@end deffn 552@end deffn
603 553
604@deffn Option semantic-idle-scheduler-no-working-message
605@anchor{semantic-idle-scheduler-no-working-message} 554@anchor{semantic-idle-scheduler-no-working-message}
606If non-@code{nil}, disable display of working messages during parse. 555@deffn Option semantic-idle-scheduler-no-working-message
556If non-@code{nil}, disable display of working messages whie reparsing.
607@end deffn 557@end deffn
608 558
609@deffn Option semantic-idle-scheduler-working-in-modeline-flag
610@anchor{semantic-idle-scheduler-working-in-modeline-flag} 559@anchor{semantic-idle-scheduler-working-in-modeline-flag}
611Non-@code{nil} means show working messages in the mode line. 560@deffn Option semantic-idle-scheduler-working-in-modeline-flag
612Typically, parsing will show messages in the minibuffer. 561If non-@code{nil}, show working messages in the mode line. Normally,
613This will move the parse message into the modeline. 562re-parsing shows messages in the minibuffer; this moves the parse
563message to the modeline instead.
614@end deffn 564@end deffn
615 565
616@defvar semantic-before-idle-scheduler-reparse-hooks 566@anchor{semantic-before-idle-scheduler-reparse-hook}
617@anchor{semantic-before-idle-scheduler-reparse-hooks} 567@defvar semantic-before-idle-scheduler-reparse-hook
618Hooks run before option @code{semantic-idle-scheduler} begins parsing. 568This normal hook is run just before the idle scheduler begins
619If any hook throws an error, this variable is reset to nil. 569reparsing. If any hook function throws an error, the value of this
620This hook is not protected from lexical errors. 570variable is reset to @code{nil}. This hook is not protected from
571lexical errors.
621@end defvar 572@end defvar
622 573
623@defvar semantic-after-idle-scheduler-reparse-hooks 574@anchor{semantic-after-idle-scheduler-reparse-hook}
624@anchor{semantic-after-idle-scheduler-reparse-hooks} 575@defvar semantic-after-idle-scheduler-reparse-hook
625Hooks run after option @code{semantic-idle-scheduler} has parsed. 576
626If any hook throws an error, this variable is reset to nil. 577This normal hook is run after the idle scheduler finishes reparsing.
578If any hook throws an error, this variable is reset to @code{nil}.
627This hook is not protected from lexical errors. 579This hook is not protected from lexical errors.
628@end defvar 580@end defvar
629 581