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