*** empty log message ***
[bpt/emacs.git] / man / ebrowse.texi
CommitLineData
2d0600a3
GM
1\input texinfo @c -*-texinfo-*-
2
2d0600a3
GM
3@comment %**start of header
4@setfilename ../info/ebrowse
5@settitle A Class Browser for C++
6@setchapternewpage odd
60a96371 7@syncodeindex fn cp
2d0600a3
GM
8@comment %**end of header
9
10@ifinfo
35ce9324 11@dircategory Emacs
2d0600a3 12@direntry
1399fef0 13* Ebrowse: (ebrowse). A C++ class browser for Emacs.
2d0600a3
GM
14@end direntry
15
16This file documents Ebrowse, a C++ class browser for GNU Emacs.
17
308374ca
DL
18Copyright @copyright{} 2000 Free Software Foundation, Inc.
19
20Permission is granted to copy, distribute and/or modify this document
21under the terms of the GNU Free Documentation License, Version 1.1 or
22any later version published by the Free Software Foundation; with no
23Invariant Sections, with the Front-Cover texts being ``A GNU
80d7cf55 24Manual,'' and with the Back-Cover Texts as in (a) below. A copy of the
308374ca
DL
25license is included in the section entitled ``GNU Free Documentation
26License'' in the Emacs manual.
27
28(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
29this GNU Manual, like GNU software. Copies published by the Free
30Software Foundation raise funds for GNU development.''
31
32This document is part of a collection distributed under the GNU Free
33Documentation License. If you want to distribute this document
34separately from the collection, you can do so by adding a copy of the
35license to the document, as described in section 6 of the license.
2d0600a3
GM
36@end ifinfo
37
60a96371 38@iftex
2d0600a3 39@titlepage
60a96371
GM
40@title Ebrowse User's Manual
41@sp 4
42@subtitle Ebrowse/Emacs 21
43@sp 1
44@subtitle May 2000
45@sp 5
46@author Gerd Moellmann
47@page
2d0600a3 48
60a96371
GM
49@vskip 0pt plus 1filll
50@noindent
51Copyright @copyright{} 2000 Free Software Foundation, Inc.
2d0600a3 52
308374ca
DL
53
54Permission is granted to copy, distribute and/or modify this document
55under the terms of the GNU Free Documentation License, Version 1.1 or
56any later version published by the Free Software Foundation; with no
57Invariant Sections, with the Front-Cover texts being ``A GNU
58Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
59license is included in the section entitled ``GNU Free Documentation
60License'' in the Emacs manual.
61
62(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
63this GNU Manual, like GNU software. Copies published by the Free
64Software Foundation raise funds for GNU development.''
65
66This document is part of a collection distributed under the GNU Free
67Documentation License. If you want to distribute this document
68separately from the collection, you can do so by adding a copy of the
69license to the document, as described in section 6 of the license.
2d0600a3 70@end titlepage
60a96371
GM
71@page
72@end iftex
2d0600a3
GM
73
74@node Top, Overview, (dir), (dir)
75
60a96371 76@ifnottex
2d0600a3
GM
77You can browse C++ class hierarchies from within Emacs by using
78Ebrowse.
60a96371 79@end ifnottex
2d0600a3
GM
80
81@menu
82* Overview:: What is it and now does it work?
83* Generating browser files:: How to process C++ source files
84* Loading a Tree:: How to start browsing
85* Tree Buffers:: Traversing class hierarchies
86* Member Buffers:: Looking at member information
87* Tags-like Functions:: Finding members from source files
88* Concept Index:: An entry for each concept defined
89@end menu
90
91
92
93
94@node Overview, Generating browser files, Top, Top
95@chapter Introduction
2d0600a3
GM
96
97When working in software projects using C++, I frequently missed
98software support for two things:
99
100@itemize @bullet
101@item
102When you get a new class library, or you have to work on source code you
103haven't written yourself (or written sufficiently long ago), you need a
91051870
DL
104tool to let you navigate class hierarchies and investigate
105features of the software. Without such a tool you often end up
106@command{grep}ing through dozens or even hundreds of files.
2d0600a3
GM
107
108@item
109Once you are productive, it would be nice to have a tool that knows your
110sources and can help you while you are editing source code. Imagine to
111be able to jump to the definition of an identifier while you are
112editing, or something that can complete long identifier names because it
113knows what identifiers are defined in your program@dots{}.
114@end itemize
115
116The design of Ebrowse reflects these two needs.
117
118How does it work?
119
60a96371 120@cindex parser for C++ sources
2d0600a3
GM
121A fast parser written in C is used to process C++ source files.
122The parser generates a data base containing information about classes,
91051870 123members, global functions, defines, types etc.@: found in the sources.
2d0600a3
GM
124
125The second part of Ebrowse is a Lisp program. This program reads
126the data base generated by the parser. It displays its contents in
127various forms and allows you to perform operations on it, or do
128something with the help of the knowledge contained in the data base.
129
60a96371 130@cindex major modes, of Ebrowse buffers
2d0600a3
GM
131@dfn{Navigational} use of Ebrowse is centered around two
132types of buffers which define their own major modes:
133
60a96371 134@cindex tree buffer
2d0600a3
GM
135@dfn{Tree buffers} are used to view class hierarchies in tree form.
136They allow you to quickly find classes, find or view class declarations,
137perform operations like query replace on sets of your source files, and
138finally tree buffers are used to produce the second buffer form---member
60a96371 139buffers. @xref{Tree Buffers}.
2d0600a3 140
60a96371 141@cindex member buffer
2d0600a3
GM
142Members are displayed in @dfn{member buffers}. Ebrowse
143distinguishes between six different types of members; each type is
144displayed as a member list of its own:
145
146@itemize @bullet
147@item
91051870 148Instance member variables;
2d0600a3
GM
149
150@item
91051870 151Instance member functions;
2d0600a3
GM
152
153@item
91051870 154Static member variables;
2d0600a3
GM
155
156@item
91051870 157Static member functions;
2d0600a3
GM
158
159@item
91051870
DL
160Friends/Defines. The list of defines is contained in the friends
161list of the pseudo-class @samp{*Globals*};
2d0600a3
GM
162
163@item
164Types (@code{enum}s, and @code{typedef}s defined with class
165scope).@refill
166@end itemize
167
168You can switch member buffers from one list to another, or to another
169class. You can include inherited members in the display, you can set
170filters that remove categories of members from the display, and most
171importantly you can find or view member declarations and definitions
60a96371 172with a keystroke. @xref{Member Buffers}.
2d0600a3
GM
173
174These two buffer types and the commands they provide support the
175navigational use of the browser. The second form resembles Emacs' Tags
176package for C and other procedural languages. Ebrowse's commands of
177this type are not confined to special buffers; they are most often used
178while you are editing your source code.
179
180To list just a subset of what you can use the Tags part of Ebrowse for:
181
182@itemize @bullet
183@item
184Jump to the definition or declaration of an identifier in your source
60a96371 185code, with an electric position stack that lets you easily navigate
2d0600a3
GM
186back and forth.
187
188@item
189Complete identifiers in your source with a completion list containing
190identifiers from your source code only.
191
192@item
193Perform search and query replace operations over some or all of your
194source files.
195
196@item
197Show all identifiers matching a regular expression---and jump to one of
198them, if you like.
199@end itemize
200
201
202
203
204@node Generating browser files, Loading a Tree, Overview, Top
205@comment node-name, next, previous, up
206@chapter Processing Source Files
2d0600a3 207
60a96371
GM
208@cindex @command{ebrowse}, the program
209@cindex class data base creation
2d0600a3 210Before you can start browsing a class hierarchy, you must run the parser
60a96371 211@command{ebrowse} on your source files in order to generate a Lisp data
2d0600a3
GM
212base describing your program.
213
60a96371
GM
214@cindex command line for @command{ebrowse}
215The operation of @command{ebrowse} can be tailored with command line
2d0600a3
GM
216options. Under normal circumstances it suffices to let the parser use
217its default settings. If you want to do that, call it with a command
218line like:
219
220@example
221ebrowse *.h *.cc
222@end example
223
224@noindent
60a96371 225or, if your shell doesn't allow all the file names to be specified on
2d0600a3
GM
226the command line,
227
228@example
229ebrowse --files=@var{file}
230@end example
231
232@noindent
233where @var{file} contains the names of the files to be parsed, one
234per line.
235
60a96371
GM
236@findex --help
237When invoked with option @samp{--help}, @command{ebrowse} prints a list of
2d0600a3
GM
238available command line options.@refill
239
240@menu
241* Input files:: Specifying which files to parse
242* Output file:: Changing the output file name
243* Structs and unions:: Omitting @code{struct}s and @code{union}s
244* Matching:: Setting regular expression lengths
245* Verbosity:: Getting feedback for lengthy operations
246@end menu
247
248
249
250
251@comment name, next, prev, up
252@node Input files, Output file, Generating browser files, Generating browser files
253@section Specifying Input Files
2d0600a3
GM
254
255@table @samp
60a96371 256@cindex input files, for @command{ebrowse}
2d0600a3 257@item file
60a96371 258Each file name on the command line tells @command{ebrowse} to parse
2d0600a3
GM
259that file.
260
60a96371
GM
261@cindex response files
262@findex --files
2d0600a3
GM
263@item --files=@var{file}
264This command line switch specifies that @var{file} contains a list of
265file names to parse. Each line in @var{file} must contain one file
266name. More than one option of this kind is allowed. You might, for
267instance, want to use one file for header files, and another for source
268files.
269
60a96371 270@cindex standard input, specifying input files
2d0600a3 271@item standard input
60a96371 272When @command{ebrowse} finds no file names on the command line, and no
2d0600a3 273@samp{--file} option is specified, it reads file names from standard
60a96371 274input. This is sometimes convenient when @command{ebrowse} is used as part
2d0600a3
GM
275of a command pipe.
276
60a96371 277@findex --search-path
2d0600a3 278@item --search-path=@var{paths}
91051870 279This option lets you specify search paths for your input files.
2d0600a3
GM
280@var{paths} is a list of directory names, separated from each other by a
281either a colon or a semicolon, depending on the operating system.
282@end table
283
60a96371
GM
284@cindex header files
285@cindex friend functions
2d0600a3
GM
286It is generally a good idea to specify input files so that header files
287are parsed before source files. This facilitates the parser's work of
288properly identifying friend functions of a class.
289
290
291
292@comment name, next, prev, up
293@node Output file, Structs and unions, Input files, Generating browser files
294@section Changing the Output File Name
2d0600a3
GM
295
296@table @samp
60a96371
GM
297@cindex output file name
298@findex --output-file
299@cindex @file{BROWSE} file
2d0600a3 300@item --output-file=@var{file}
60a96371 301This option instructs @command{ebrowse} to generate a Lisp data base with
2d0600a3 302name @var{file}. By default, the data base is named @file{BROWSE}, and
60a96371 303is written in the directory in which @command{ebrowse} is invoked.
2d0600a3
GM
304
305If you regularly use data base names different from the default, you
60a96371 306might want to add this to your init file:
2d0600a3
GM
307
308@lisp
309(add-to-list 'auto-mode-alist '(@var{NAME} . ebrowse-tree-mode))
310@end lisp
311
312@noindent
313where @var{NAME} is the Lisp data base name you are using.
314
60a96371
GM
315@findex --append
316@cindex appending output to class data base
2d0600a3 317@item --append
60a96371
GM
318By default, each run of @command{ebrowse} erases the old contents of the
319output file when writing to it. You can instruct @command{ebrowse} to
3ddfb687 320append its output to an existing file produced by @command{ebrowse}
bfb01a95 321with this command line option.
2d0600a3
GM
322@end table
323
324
325
326
327@comment name, next, prev, up
328@node Structs and unions, Matching, Output file, Generating browser files
329@section Structs and Unions
330@cindex structs
331@cindex unions
2d0600a3
GM
332
333@table @samp
60a96371 334@findex --no-structs-or-unions
2d0600a3
GM
335@item --no-structs-or-unions
336This switch suppresses all classes in the data base declared as
337@code{struct} or @code{union} in the output.
338
91051870 339This is mainly useful when you are converting an existing
2d0600a3
GM
340C program to C++, and do not want to see the old C structs in a class
341tree.
342@end table
343
344
345
346
347@comment name, next, prev, up
348@node Matching, Verbosity, Structs and unions, Generating browser files
349@section Regular Expressions
2d0600a3 350
60a96371
GM
351@cindex regular expressions, recording
352The parser @command{ebrowse} normally writes regular expressions to its
353output file that help the Lisp part of Ebrowse to find functions,
91051870 354variables etc.@: in their source files.
2d0600a3 355
60a96371
GM
356You can instruct @command{ebrowse} to omit these regular expressions by
357calling it with the command line switch @samp{--no-regexps}.
2d0600a3
GM
358
359When you do this, the Lisp part of Ebrowse tries to guess, from member
360or class names, suitable regular expressions to locate that class or
361member in source files. This works fine in most cases, but the
362automatic generation of regular expressions can be too weak if unusual
363coding styles are used.
364
365@table @samp
60a96371 366@findex --no-regexps
2d0600a3 367@item --no-regexps
91051870 368This option turns off regular expression recording.
2d0600a3 369
60a96371
GM
370@findex --min-regexp-length
371@cindex minimum regexp length for recording
2d0600a3
GM
372@item --min-regexp-length=@var{n}
373The number @var{n} following this option specifies the minimum length of
374the regular expressions recorded to match class and member declarations
375and definitions. The default value is set at compilation time of
60a96371 376@command{ebrowse}.
2d0600a3 377
91051870 378The smaller the minimum length, the higher the probability that
2d0600a3
GM
379Ebrowse will find a wrong match. The larger the value, the
380larger the output file and therefore the memory consumption once the
381file is read from Emacs.
382
60a96371
GM
383@findex --max-regexp-length
384@cindex maximum regexp length for recording
2d0600a3
GM
385@item --max-regexp-length=@var{n}
386The number following this option specifies the maximum length of the
387regular expressions used to match class and member declarations and
388definitions. The default value is set at compilation time of
60a96371 389@command{ebrowse}.
2d0600a3 390
91051870 391The larger the maximum length, the higher the probability that the
2d0600a3
GM
392browser will find a correct match, but the larger the value the larger
393the output file and therefore the memory consumption once the data is
91051870 394read. As a second effect, the larger the regular expression, the higher
2d0600a3
GM
395the probability that it will no longer match after editing the file.
396@end table
397
398
399
400
401@node Verbosity, , Matching, Generating browser files
402@comment node-name, next, previous, up
403@section Verbose Mode
60a96371 404@cindex verbose operation
2d0600a3
GM
405
406@table @samp
60a96371 407@findex --verbose
2d0600a3 408@item --verbose
60a96371 409When this option is specified on the command line, @command{ebrowse} prints
2d0600a3
GM
410a period for each file parsed, and it displays a @samp{+} for each
411class written to the output file.
412
60a96371 413@findex --very-verbose
2d0600a3 414@item --very-verbose
60a96371 415This option makes @command{ebrowse} print out the names of the files and
2d0600a3
GM
416the names of the classes seen.
417@end table
418
419
420
421
422@node Loading a Tree, Tree Buffers, Generating browser files, Top
423@comment node-name, next, previous, up
424@chapter Starting to Browse
425@cindex loading
426@cindex browsing
427
60a96371 428You start browsing a class hierarchy parsed by @command{ebrowse} by just
2d0600a3
GM
429finding the @file{BROWSE} file with @kbd{C-x C-f}.
430
431An example of a tree buffer display is shown below.
432
433@example
434| Collection
435| IndexedCollection
436| Array
437| FixedArray
438| Set
439| Dictionary
440@end example
441
60a96371
GM
442@cindex mouse highlight in tree buffers
443When you run Emacs on a display which supports colors and the mouse, you
7cd0d847 444will notice that certain areas in the tree buffer are highlighted
60a96371
GM
445when you move the mouse over them. This highlight marks mouse-sensitive
446regions in the buffer. Please notice the help strings in the echo area
447when the mouse moves over a sensitive region.
2d0600a3 448
60a96371 449@cindex context menu
80d7cf55 450A click with @kbd{Mouse-3} on a mouse-sensitive region opens a context
2d0600a3 451menu. In addition to this, each buffer also has a buffer-specific menu
80d7cf55 452that is opened with a click with @kbd{Mouse-3} somewhere in the buffer
2d0600a3
GM
453where no highlight is displayed.
454
455
456
457@comment ****************************************************************
458@comment ***
459@comment *** TREE BUFFERS
460@comment ***
461@comment ****************************************************************
462
463@node Tree Buffers, Member Buffers, Loading a Tree, Top
464@comment node-name, next, previous, up
465@chapter Tree Buffers
2d0600a3
GM
466@cindex tree buffer mode
467@cindex class trees
468
469Class trees are displayed in @dfn{tree buffers} which install their own
470major mode. Most Emacs keys work in tree buffers in the usual way,
91051870 471e.g.@: you can move around in the buffer with the usual @kbd{C-f},
2d0600a3
GM
472@kbd{C-v} etc., or you can search with @kbd{C-s}.
473
474Tree-specific commands are bound to simple keystrokes, similar to
475@code{Gnus}. You can take a look at the key bindings by entering
476@kbd{?} which calls @code{M-x describe-mode} in both tree and member
477buffers.
478
479@menu
480* Source Display:: Viewing and finding a class declaration
481* Member Display:: Showing members, switching to member buffers
482* Go to Class:: Finding a class
483* Quitting:: Discarding and burying the tree buffer
484* File Name Display:: Showing file names in the tree
485* Expanding and Collapsing:: Expanding and collapsing branches
486* Tree Indentation:: Changing the tree indentation
487* Killing Classes:: Removing class from the tree
488* Saving a Tree:: Saving a modified tree
489* Statistics:: Displaying class tree statistics
490* Marking Classes:: Marking and unmarking classes
491@end menu
492
493
494
495@node Source Display, Member Display, Tree Buffers, Tree Buffers
496@comment node-name, next, previous, up
497@section Viewing and Finding Class Declarations
498@cindex viewing, class
60a96371 499@cindex finding a class
2d0600a3
GM
500@cindex class declaration
501
502You can view or find a class declaration when the cursor is on a class
503name.
504
505@table @kbd
506@item SPC
507This command views the class declaration if the database
508contains informations about it. If you don't parse the entire source
509you are working on, some classes will only be known to exist but the
510location of their declarations and definitions will not be known.@refill
511
512@item RET
513Works like @kbd{SPC}, except that it finds the class
514declaration rather than viewing it, so that it is ready for
515editing.@refill
516@end table
517
518The same functionality is available from the menu opened with
80d7cf55 519@kbd{Mouse-3} on the class name.
2d0600a3
GM
520
521
522
523
524@node Member Display, Go to Class, Source Display, Tree Buffers
525@comment node-name, next, previous, up
526@section Displaying Members
60a96371 527@cindex @samp{*Members*} buffer
2d0600a3 528@cindex @samp{*Globals*}
60a96371
GM
529@cindex freezing a member buffer
530@cindex member lists, in tree buffers
2d0600a3
GM
531
532Ebrowse distinguishes six different kinds of members, each of
533which is displayed as a separate @dfn{member list}: instance variables,
534instance functions, static variables, static functions, friend
535functions, and types.
536
537Each of these lists can be displayed in a member buffer with a command
538starting with @kbd{L} when the cursor is on a class name. By default,
539there is only one member buffer named @dfn{*Members*} that is reused
540each time you display a member list---this has proven to be more
541practical than to clutter up the buffer list with dozens of member
542buffers.
543
544If you want to display more than one member list at a time you can
545@dfn{freeze} its member buffer. Freezing a member buffer prevents it
546from being overwritten the next time you display a member list. You can
547toggle this buffer status at any time.
548
549Every member list display command in the tree buffer can be used with a
550prefix argument (@kbd{C-u}). Without a prefix argument, the command will
551pop to a member buffer displaying the member list. With prefix argument,
552the member buffer will additionally be @dfn{frozen}.
553
554@table @kbd
60a96371 555@cindex instance member variables, list
2d0600a3
GM
556@item L v
557This command displays the list of instance member variables.
558
60a96371 559@cindex static variables, list
2d0600a3
GM
560@item L V
561Display the list of static variables.
562
60a96371 563@cindex friend functions, list
2d0600a3
GM
564@item L d
565Display the list of friend functions. This list is used for defines if
566you are viewing the class @samp{*Globals*} which is a place holder for
567global symbols.
568
60a96371 569@cindex member functions, list
2d0600a3
GM
570@item L f
571Display the list of member functions.
572
60a96371 573@cindex static member functions, list
2d0600a3
GM
574@item L F
575Display the list of static member functions.
576
60a96371 577@cindex types, list
2d0600a3
GM
578@item L t
579Display a list of types.
580@end table
581
582These lists are also available from the class' context menu invoked with
80d7cf55 583@kbd{Mouse-3} on the class name.
2d0600a3
GM
584
585
586
587
588@node Go to Class, Quitting, Member Display, Tree Buffers
589@comment node-name, next, previous, up
590@section Finding a Class
591@cindex locate class
592@cindex expanding branches
60a96371 593@cindex class location
2d0600a3
GM
594
595@table @kbd
60a96371 596@cindex search for class
2d0600a3
GM
597@item /
598This command reads a class name from the minibuffer with completion and
599positions the cursor on the class in the class tree.
600
601If the branch of the class tree containing the class searched for is
602currently collapsed, the class itself and all its base classes are
60a96371 603recursively made visible. (See also @ref{Expanding and
2d0600a3
GM
604Collapsing}.)@refill
605
606This function is also available from the tree buffer's context menu.
607
608@item n
609Repeat the last search done with @kbd{/}. Each tree buffer has its own
610local copy of the regular expression last searched in it.
611@end table
612
613
614
615
616@node Quitting, File Name Display, Go to Class, Tree Buffers
617@comment node-name, next, previous, up
618@section Burying a Tree Buffer
60a96371 619@cindex burying tree buffer
2d0600a3
GM
620
621@table @kbd
622@item q
623Is a synonym for @kbd{M-x bury-buffer}.
624@end table
625
626
627
628
629@node File Name Display, Expanding and Collapsing, Quitting, Tree Buffers
630@comment node-name, next, previous, up
631@section Displaying File Names
2d0600a3
GM
632
633@table @kbd
60a96371 634@cindex file names in tree buffers
2d0600a3
GM
635@item T f
636This command toggles the display of file names in a tree buffer. If
637file name display is switched on, the names of the files containing the
638class declaration are shown to the right of the class names. If the
639file is not known, the string @samp{unknown} is displayed.
640
641This command is also provided in the tree buffer's context menu.
642
643@item s
644Display file names for the current line, or for the number of lines
645given by a prefix argument.
646@end table
647
648Here is an example of a tree buffer with file names displayed.
649
650@example
651| Collection (unknown)
652| IndexedCollection (indexedcltn.h)
653| Array (array.h)
654| FixedArray (fixedarray.h)
655| Set (set.h)
656| Dictionary (dict.h)
657@end example
658
659
660
661
662@node Expanding and Collapsing, Tree Indentation, File Name Display, Tree Buffers
663@comment node-name, next, previous, up
664@section Expanding and Collapsing a Tree
60a96371
GM
665@cindex expand tree branch
666@cindex collapse tree branch
667@cindex branches of class tree
668@cindex class tree, collapse or expand
2d0600a3
GM
669
670You can expand and collapse parts of a tree to reduce the complexity of
671large class hierarchies. Expanding or collapsing branches of a tree has
672no impact on the functionality of other commands, like @kbd{/}. (See
60a96371 673also @ref{Go to Class}.)@refill
2d0600a3
GM
674
675Collapsed branches are indicated with an ellipsis following the class
676name like in the example below.
677
678@example
679| Collection
680| IndexedCollection...
681| Set
682| Dictionary
683@end example
684
685@table @kbd
686@item -
687This command collapses the branch of the tree starting at the class the
688cursor is on.
689
690@item +
691This command expands the branch of the tree starting at the class the
91051870 692cursor is on. Both commands for collapsing and expanding branches are
2d0600a3
GM
693also available from the class' object menu.
694
695@item *
696This command expands all collapsed branches in the tree.
697@end table
698
699
700
701
702@node Tree Indentation, Killing Classes, Expanding and Collapsing, Tree Buffers
703@comment node-name, next, previous, up
704@section Changing the Tree Indentation
705@cindex tree indentation
60a96371 706@cindex indentation of the tree
2d0600a3
GM
707
708@table @kbd
709@item T w
710This command reads a new indentation width from the minibuffer and
91051870 711redisplays the tree buffer with the new indentation It is also
2d0600a3
GM
712available from the tree buffer's context menu.
713@end table
714
715
716
717
718@node Killing Classes, Saving a Tree, Tree Indentation, Tree Buffers
719@comment node-name, next, previous, up
720@section Removing Classes from the Tree
721@cindex killing classes
60a96371 722@cindex class, remove from tree
2d0600a3
GM
723
724@table @kbd
725@item C-k
726This command removes the class the cursor is on and all its derived
727classes from the tree. The user is asked for confirmation before the
728deletion is actually performed.
729@end table
730
731
732
733
734@node Saving a Tree, Statistics, Killing Classes, Tree Buffers
735@comment node-name, next, previous, up
736@comment node-name, next, previous, up
737@section Saving a Tree
60a96371
GM
738@cindex save tree to a file
739@cindex tree, save to a file
740@cindex class tree, save to a file
2d0600a3
GM
741
742@table @kbd
743@item C-x C-s
91051870
DL
744This command writes a class tree to the file from which it was read.
745This is useful after classes have been deleted from a tree.
2d0600a3
GM
746
747@item C-x C-w
748Writes the tree to a file whose name is read from the minibuffer.
749@end table
750
751
752
753
754@node Statistics, Marking Classes, Saving a Tree, Tree Buffers
755@comment node-name, next, previous, up
60a96371
GM
756@cindex statistics for a tree
757@cindex tree statistics
758@cindex class statistics
2d0600a3
GM
759
760@table @kbd
761@item x
762Display statistics for the tree, like number of classes in it, number of
763member functions, etc. This command can also be found in the buffer's
764context menu.
765@end table
766
767
768
769
770@node Marking Classes, , Statistics, Tree Buffers
771@comment node-name, next, previous, up
772@cindex marking classes
60a96371 773@cindex operations on marked classes
2d0600a3
GM
774
775Classes can be marked for operations similar to the standard Emacs
776commands @kbd{M-x tags-search} and @kbd{M-x tags-query-replace} (see
777also @xref{Tags-like Functions}.)@refill
778
779@table @kbd
60a96371 780@cindex toggle mark
2d0600a3
GM
781@item M t
782Toggle the mark of the line point is in or for as many lines as given by
783a prefix command. This command can also be found in the class' context
784menu.
785
60a96371 786@cindex unmark all
2d0600a3
GM
787@item M a
788Unmark all classes. With prefix argument @kbd{C-u}, mark all classes in
789the tree. Since this command operates on the whole buffer, it can also be
790found in the buffer's object menu.
791@end table
792
793Marked classes are displayed with an @code{>} in column one of the tree
794display, like in the following example
795
796@example
797|> Collection
798| IndexedCollection...
799|> Set
800| Dictionary
801@end example
802
803
804
805
806@c ****************************************************************
807@c ***
808@c *** MEMBER BUFFERS
809@c ***
810@c ****************************************************************
811
812@node Member Buffers, Tags-like Functions, Tree Buffers, Top
813@comment node-name, next, previous, up
814@chapter Member Buffers
2d0600a3
GM
815@cindex members
816@cindex member buffer mode
817
60a96371
GM
818@cindex class members, types
819@cindex types of class members
2d0600a3
GM
820@dfn{Member buffers} are used to operate on lists of members of a class.
821Ebrowse distinguishes six kinds of lists:
822
823@itemize @bullet
824@item
91051870 825Instance variables (normal member variables);
2d0600a3 826@item
91051870 827Instance functions (normal member functions);
2d0600a3 828@item
91051870 829Static variables;
2d0600a3 830@item
91051870 831Static member functions;
2d0600a3 832@item
91051870 833Friend functions;
2d0600a3
GM
834@item
835Types (@code{enum}s and @code{typedef}s defined with class scope.
836Nested classes will be shown in the class tree like normal classes.
837@end itemize
838
839Like tree buffers, member buffers install their own major mode. Also
840like in tree buffers, menus are provided for certain areas in the
841buffer: members, classes, and the buffer itself.
842
843@menu
844* Switching Member Lists:: Choosing which members to display
845* Finding/Viewing:: Modifying source code
846* Inherited Members:: Display of Inherited Members
847* Searching Members:: Finding members in member buffer
848* Switching to Tree:: Going back to the tree buffer
849* Filters:: Selective member display
850* Attributes:: Display of @code{virtual} etc.
851* Long and Short Display:: Comprehensive and verbose display
852* Regexp Display:: Showing matching regular expressions
853* Switching Classes:: Displaying another class
854* Killing/Burying:: Getting rid of the member buffer
855* Column Width:: Display style
856* Redisplay:: Redrawing the member list
857* Getting Help:: How to get help for key bindings
858@end menu
859
860
861
862
863@node Switching Member Lists, Finding/Viewing, Member Buffers, Member Buffers
864@comment node-name, next, previous, up
865@section Switching Member Lists
60a96371 866@cindex member lists, in member buffers
2d0600a3
GM
867@cindex static members
868@cindex friends
869@cindex types
870@cindex defines
871
872@table @kbd
60a96371 873@cindex next member list
2d0600a3
GM
874@item L n
875This command switches the member buffer display to the next member list.
876
60a96371 877@cindex previous member list
2d0600a3
GM
878@item L p
879This command switches the member buffer display to the previous member
880list.
881
882@item L f
883Switch to the list of member functions.
884
60a96371 885@cindex static
2d0600a3
GM
886@item L F
887Switch to the list of static member functions.
888
889@item L v
890Switch to the list of member variables.
891
892@item L V
893Switch to the list of static member variables.
894
895@item L d
896Switch to the list of friends or defines.
897
898@item L t
91051870 899Switch to the list of types.
2d0600a3
GM
900@end table
901
902Both commands cycle through the member list.
903
904Most of the commands are also available from the member buffer's
905context menu.
906
907
908
909
910@node Finding/Viewing, Inherited Members, Switching Member Lists, Member Buffers
911@comment node-name, next, previous, up
912@section Finding and Viewing Member Source
60a96371
GM
913@cindex finding members, in member buffers
914@cindex viewing members, in member buffers
915@cindex member definitions, in member buffers
916@cindex member declarations, in member buffers
917@cindex definition of a member, in member buffers
918@cindex declaration of a member, in member buffers
2d0600a3
GM
919
920@table @kbd
921@item RET
922This command finds the definition of the member the cursor is on.
923Finding involves roughly the same as the standard Emacs tags facility
924does---loading the file and searching for a regular expression matching
925the member.
926
927@item f
928This command finds the declaration of the member the cursor is on.
929
930@item SPC
931This is the same command as @kbd{RET}, but views the member definition
932instead of finding the member's source file.
933
934@item v
935This is the same command as @kbd{f}, but views the member's declaration
936instead of finding the file the declaration is in.
937@end table
938
939You can install a hook function to perform actions after a member or
940class declaration or definition has been found, or when it is not found.
941
942All the commands described above can also be found in the context menu
80d7cf55 943displayed when clicking @kbd{Mouse-2} on a member name.
2d0600a3
GM
944
945
946
947
948@node Inherited Members, Searching Members, Finding/Viewing, Member Buffers
949@comment node-name, next, previous, up
950@section Display of Inherited Members
60a96371
GM
951@cindex superclasses, members
952@cindex base classes, members
2d0600a3
GM
953@cindex inherited members
954
955@table @kbd
956@item D b
957This command toggles the display of inherited members in the member
91051870 958buffer. This is also in the buffer's context menu.
2d0600a3
GM
959@end table
960
961
962
963
964@node Searching Members, Switching to Tree, Inherited Members, Member Buffers
965@comment node-name, next, previous, up
966@section Searching Members
967@cindex searching members
968
969@table @kbd
970@item G v
971Position the cursor on a member whose name is read from the minibuffer;
972only members shown in the current member buffer appear in the completion
973list.
974
975@item G m
976Like the above command, but all members for the current class appear in
91051870 977the completion list. If necessary, the current member list is switched
2d0600a3
GM
978to the one containing the member.
979
980With a prefix argument (@kbd{C-u}), all members in the class tree,
91051870
DL
981i.e.@: all members the browser knows about appear in the completion
982list. The member display will be switched to the class and member list
2d0600a3
GM
983containing the member.
984
985@item G n
986Repeat the last member search.
987@end table
988
989Look into the buffer's context menu for a convenient way to do this with
990a mouse.
991
992
993
994@node Switching to Tree, Filters, Searching Members, Member Buffers
995@comment node-name, next, previous, up
996@section Switching to Tree Buffer
60a96371 997@cindex tree buffer, switch to
2d0600a3
GM
998@cindex buffer switching
999@cindex switching buffers
1000
1001@table @kbd
1002@item TAB
1003Pop up the tree buffer to which the member buffer belongs.
1004
1005@item t
1006Do the same as @kbd{TAB} but also position the cursor on the class
1007displayed in the member buffer.
1008@end table
1009
1010
1011
1012
1013@node Filters, Attributes, Switching to Tree, Member Buffers
1014@comment node-name, next, previous, up
1015@section Filters
1016@cindex filters
2d0600a3
GM
1017
1018@table @kbd
60a96371 1019@cindex @code{public} members
2d0600a3
GM
1020@item F a u
1021This command toggles the display of @code{public} members. The
1022@samp{a} stands for `access'.
1023
60a96371 1024@cindex @code{protected} members
2d0600a3
GM
1025@item F a o
1026This command toggles the display of @code{protected} members.
1027
60a96371 1028@cindex @code{private} members
2d0600a3
GM
1029@item F a i
1030This command toggles the display of @code{private} members.
1031
60a96371 1032@cindex @code{virtual} members
2d0600a3
GM
1033@item F v
1034This command toggles the display of @code{virtual} members.
1035
60a96371 1036@cindex @code{inline} members
2d0600a3
GM
1037@item F i
1038This command toggles the display of @code{inline} members.
1039
60a96371 1040@cindex @code{const} members
2d0600a3
GM
1041@item F c
1042This command toggles the display of @code{const} members.
1043
60a96371 1044@cindex pure virtual members
2d0600a3
GM
1045@item F p
1046This command toggles the display of pure virtual members.
1047
60a96371 1048@cindex remove filters
2d0600a3
GM
1049@item F r
1050This command removes all filters.
1051@end table
1052
1053These commands are also found in the buffer's context menu.
1054
1055
1056
1057
1058@node Attributes, Long and Short Display, Filters, Member Buffers
1059@comment node-name, next, previous, up
1060@section Displaying Member Attributes
1061@cindex attributes
60a96371 1062@cindex member attribute display
2d0600a3
GM
1063
1064@table @kbd
1065@item D a
1066Toggle the display of member attributes (default is on).
1067
7cd0d847 1068The nine member attributes Ebrowse knows about are displayed
2d0600a3
GM
1069as a list a single-characters flags enclosed in angle brackets in front
1070the of the member's name. A @samp{-} at a given position means that
1071the attribute is false. The list of attributes from left to right is
1072
1073@table @samp
60a96371 1074@cindex @code{template} attribute
2d0600a3
GM
1075@item T
1076The member is a template.
1077
60a96371 1078@cindex @code{extern "C"} attribute
2d0600a3
GM
1079@item C
1080The member is declared @code{extern "C"}.
1081
60a96371 1082@cindex @code{virtual} attribute
2d0600a3
GM
1083@item v
1084Means the member is declared @code{virtual}.
1085
60a96371 1086@cindex @code{inline}
2d0600a3
GM
1087@item i
1088The member is declared @code{inline}.
1089
60a96371 1090@cindex @code{const} attribute
2d0600a3
GM
1091@item c
1092The member is @code{const}.
1093
60a96371 1094@cindex pure virtual function attribute
2d0600a3
GM
1095@item 0
1096The member is a pure virtual function.
1097
60a96371 1098@cindex @code{mutable} attribute
2d0600a3
GM
1099@item m
1100The member is declared @code{mutable}.
1101
60a96371 1102@cindex @code{explicit} attribute
2d0600a3
GM
1103@item e
1104The member is declared @code{explicit}.
1105
1106@item t
1107The member is a function with a throw list.
1108@end table
1109@end table
1110
1111This command is also in the buffer's context menu.
1112
1113
1114
1115@node Long and Short Display, Regexp Display, Attributes, Member Buffers
1116@comment node-name, next, previous, up
1117@section Long and Short Member Display
1118@cindex display form
1119@cindex long display
1120@cindex short display
2d0600a3
GM
1121
1122@table @kbd
1123@item D l
1124This command toggles the member buffer between short and long display
1125form. The short display form displays member names, only:
1126
1127@example
1128| isEmpty contains hasMember create
1129| storeSize hash isEqual restoreGuts
1130| saveGuts
1131@end example
1132
1133The long display shows one member per line with member name and regular
1134expressions matching the member (if known):
1135
1136@example
1137| isEmpty Bool isEmpty () const...
1138| hash unsigned hash () const...
1139| isEqual int isEqual (...
1140@end example
1141
1142Regular expressions will only be displayed when the Lisp database has
60a96371
GM
1143not been produced with the @command{ebrowse} option @samp{--no-regexps}.
1144@xref{Matching, --no-regexps, Regular Expressions}.
2d0600a3
GM
1145@end table
1146
1147
1148
1149
1150@node Regexp Display, Switching Classes, Long and Short Display, Member Buffers
1151@comment node-name, next, previous, up
1152@section Display of Regular Expressions
1153@cindex regular expression display
1154
1155@table @kbd
1156@item D r
1157This command toggles the long display form from displaying the regular
1158expressions matching the member declarations to those expressions
1159matching member definitions.
1160@end table
1161
1162Regular expressions will only be displayed when the Lisp database has
60a96371
GM
1163not been produced with the @command{ebrowse} option @samp{--no-regexps},
1164see @ref{Matching, --no-regexps, Regular Expressions}.
2d0600a3
GM
1165
1166
1167
1168
1169@node Switching Classes, Killing/Burying, Regexp Display, Member Buffers
1170@comment node-name, next, previous, up
1171@section Displaying Another Class
60a96371
GM
1172@cindex base class, display
1173@cindex derived class, display
1174@cindex superclass, display
1175@cindex subclass, display
2d0600a3
GM
1176@cindex class display
1177
1178@table @kbd
1179@item C c
1180This command lets you switch the member buffer to another class. It
1181reads the name of the new class from the minibuffer with completion.
1182
1183@item C b
1184This is the same command as @kbd{C c} but restricts the classes shown in
1185the completion list to immediate base classes, only. If only one base
1186class exists, this one is immediately shown in the minibuffer.
1187
1188@item C d
1189Same as @kbd{C b}, but for derived classes.
1190
1191@item C p
1192Switch to the previous class in the class hierarchy on the same level as
1193the class currently displayed.
1194
1195@item C n
1196Switch to the next sibling of the class in the class tree.
1197@end table
1198
1199
1200
1201
1202@node Killing/Burying, Column Width, Switching Classes, Member Buffers
1203@comment node-name, next, previous, up
1204@section Burying a Member Buffer
1205@cindex burying member buffers
1206
1207@table @kbd
1208@item q
1209This command is a synonym for @kbd{M-x bury-buffer}.
1210@end table
1211
1212
1213
1214
1215@node Column Width, Redisplay, Killing/Burying, Member Buffers
1216@comment node-name, next, previous, up
1217@section Setting the Column Width
1218@cindex column width
1219@cindex member indentation
1220@cindex indentation, member
1221
1222@table @kbd
1223@item D w
1224This command sets the column width depending on the display form used
1225(long or short display).
1226@end table
1227
1228
1229
1230
1231@node Redisplay, Getting Help, Column Width, Member Buffers
1232@comment node-name, next, previous, up
1233@section Forced Redisplay
60a96371 1234@cindex redisplay of member buffers
2d0600a3
GM
1235
1236@table @kbd
1237@item C-l
1238This command forces a redisplay of the member buffer. If the width
1239of the window displaying the member buffer is changed this command
1240redraws the member list with the appropriate column widths and number of
1241columns.
1242@end table
1243
1244
1245
1246
1247@node Getting Help, , Redisplay, Member Buffers
1248@comment node-name, next, previous, up
1249@cindex help
1250
1251@table @kbd
1252@item ?
1253This key is bound to @code{describe-mode}.
1254@end table
1255
1256
1257
1258
1259@comment **************************************************************
1260@comment *** TAGS LIKE FUNCTIONS
1261@comment **************************************************************
1262
1263@node Tags-like Functions, Concept Index, Member Buffers, Top
1264@comment node-name, next, previous, up
1265@chapter Tags-like Functions
1266
1267Ebrowse provides tags functions similar to those of the standard
1268Emacs Tags facility, but better suited to the needs of C++ programmers.
1269
1270@menu
1271* Finding and Viewing:: Going to a member declaration/definition
1272* Position Stack:: Moving to previous locations
1273* Search & Replace:: Searching and replacing over class tree files
1274* Members in Files:: Listing all members in a given file
1275* Apropos:: Listing members matching a regular expression
1276* Symbol Completion:: Completing names while editing
1277* Member Buffer Display:: Quickly display a member buffer for some
1278 identifier
1279@end menu
1280
1281
1282
1283@node Finding and Viewing, Position Stack, Tags-like Functions, Tags-like Functions
1284@comment node-name, next, previous, up
1285@section Finding and Viewing Members
60a96371
GM
1286@cindex finding class member, in C++ source
1287@cindex viewing class member, in C++ source
2d0600a3 1288@cindex tags
60a96371
GM
1289@cindex member definition, finding, in C++ source
1290@cindex member declaration, finding, in C++ source
1291
1292The functions in this section are similar to those described in
1293@ref{Source Display}, and also in @ref{Finding/Viewing}, except that
1294they work in a C++ source buffer, not in member and tree buffers created
1295by Ebrowse.
2d0600a3
GM
1296
1297@table @kbd
1298@item C-c b f
1299Find the definition of the member around point. If you invoke this
1300function with a prefix argument, the declaration is searched.
1301
1302If more than one class contains a member with the given name you can
1303select the class with completion. If there is a scope declaration in
1304front of the member name, this class name is used as initial input for
1305the completion.
1306
1307@item C-c b F
60a96371 1308Find the declaration of the member around point.
2d0600a3
GM
1309
1310@item C-c b v
1311View the definition of the member around point.
1312
1313@item C-c b V
1314View the declaration of the member around point.
1315
1316@item C-c b 4 f
1317Find a member's definition in another window.
1318
1319@item C-c b 4 F
1320Find a member's declaration in another window.
1321
1322@item C-c b 4 v
1323View a member's definition in another window.
1324
1325@item C-c b 4 V
1326View a member's declaration in another window.
1327
1328@item C-c b 5 f
1329Find a member's definition in another frame.
1330
1331@item C-c b 5 F
1332Find a member's declaration in another frame.
1333
1334@item C-c b 5 v
1335View a member's definition in another frame.
1336
1337@item C-c b 5 V
1338View a member's declaration in another frame.
1339@end table
1340
1341
1342
1343@node Position Stack, Search & Replace, Finding and Viewing, Tags-like Functions
1344@comment node-name, next, previous, up
1345@section The Position Stack
1346@cindex position stack
1347
1348When jumping to a member declaration or definition with one of
1349Ebrowse's commands, the position from where you performed the
1350jump and the position where you jumped to are recorded in a
1351@dfn{position stack}. There are several ways in which you can quickly
1352move to positions in the stack:@refill
1353
1354@table @kbd
60a96371 1355@cindex return to original position
2d0600a3
GM
1356@item C-c b -
1357This command sets point to the previous position in the position stack.
1358Directly after you performed a jump, this will put you back to the
1359position where you came from.
1360
91051870 1361The stack is not popped, i.e.@: you can always switch back and forth
2d0600a3
GM
1362between positions in the stack. To avoid letting the stack grow to
1363infinite size there is a maximum number of positions defined. When this
1364number is reached, older positions are discarded when new positions are
1365pushed on the stack.
1366
1367@item C-c b +
1368This command moves forward in the position stack, setting point to
1369the next position stored in the position stack.
1370
1371@item C-c b p
1372Displays an electric buffer showing all positions saved in the stack.
91051870 1373You can select a position by pressing @kbd{SPC} in a line. You can
2d0600a3
GM
1374view a position with @kbd{v}.
1375@end table
1376
1377
1378
1379
60a96371 1380@node Search & Replace, Members in Files, Position Stack, Tags-like Functions
2d0600a3
GM
1381@comment node-name, next, previous, up
1382@section Searching and Replacing
60a96371
GM
1383@cindex searching multiple C++ files
1384@cindex replacing in multiple C++ files
2d0600a3
GM
1385@cindex restart tags-operation
1386
1387Ebrowse allows you to perform operations on all or a subset of the files
1388mentioned in a class tree. When you invoke one of the following
1389functions and more than one class tree is loaded, you must choose a
1390class tree to use from an electric tree menu. If the selected tree
1391contains marked classes, the following commands operate on the files
1392mentioned in the marked classes only. Otherwise all files in the class
1393tree are used.
1394
1395@table @kbd
1396@item C-c b s
1397This function performs a regular expression search in the chosen set of
1398files.
1399
1400@item C-c b u
1401This command performs a search for calls of a given member which is
1402selected in the usual way with completion.
1403
1404@item C-c b %
1405Perform a query replace over the set of files.
1406
1407@item C-c b ,
91051870 1408All three operations above stop when finding a match. You can restart
2d0600a3
GM
1409the operation with this command.
1410
1411@item C-c b n
1412This restarts the last tags operation with the next file in the list.
1413@end table
1414
1415
1416
1417
1418@node Members in Files, Apropos, Search & Replace, Tags-like Functions
1419@comment node-name, next, previous, up
1420@section Members in Files
1421@cindex files
60a96371
GM
1422@cindex members in file, listing
1423@cindex list class members in a file
2d0600a3
GM
1424@cindex file, members
1425
1426The command @kbd{C-c b l}, lists all members in a given file. The file
1427name is read from the minibuffer with completion.
1428
1429
1430
1431
1432@node Apropos, Symbol Completion, Members in Files, Tags-like Functions
1433@comment node-name, next, previous, up
1434@section Member Apropos
60a96371 1435@cindex apropos on class members
2d0600a3
GM
1436@cindex members, matching regexp
1437
1438The command @kbd{C-c b a} can be used to display all members matching a
1439given regular expression. This command can be very useful if you
1440remember only part of a member name, and not its beginning.
1441
1442A special buffer is popped up containing all identifiers matching the
91051870 1443regular expression, and what kind of symbol it is (e.g.@: a member
2d0600a3
GM
1444function, or a type). You can then switch to this buffer, and use the
1445command @kbd{C-c b f}, for example, to jump to a specific member.
1446
1447
1448
1449
1450@node Symbol Completion, Member Buffer Display, Apropos, Tags-like Functions
1451@comment node-name, next, previous, up
1452@section Symbol Completion
1453@cindex completion
1454@cindex symbol completion
1455
1456The command @kbd{C-c b TAB} completes the symbol in front of point.
1457
1458
1459
1460
1461@node Member Buffer Display, , Symbol Completion, Tags-like Functions
1462@section Quick Member Display
60a96371 1463@cindex member buffer, for member at point
2d0600a3
GM
1464
1465You can quickly display a member buffer containing the member the cursor
1466in on with the command @kbd{C-c b m}.
1467
1468
1469@node Concept Index, , Tags-like Functions, Top
1470@unnumbered Concept Index
1471@printindex cp
1472
1473@contents
1474@bye