Include GFDL.
[bpt/emacs.git] / man / speedbar.texi
CommitLineData
4e7428f6 1\input texinfo @c -*-texinfo-*-
4e7428f6
EL
2
3@setfilename ../info/speedbar
4@settitle Speedbar: File/Tag summarizing utility
18f952d5 5@syncodeindex fn cp
4e7428f6 6
18f952d5 7@copying
62eda0e2
GM
8Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
92007 Free Software Foundation, Inc.
4ea14a3b 10
18f952d5 11@quotation
4ea14a3b 12Permission is granted to copy, distribute and/or modify this document
678e7c71 13under the terms of the GNU Free Documentation License, Version 1.2 or
4ea14a3b
DL
14any later version published by the Free Software Foundation; with the
15Invariant Sections being ``The GNU Manifesto'', ``Distribution'' and
16``GNU GENERAL PUBLIC LICENSE'', with the Front-Cover texts being ``A GNU
17Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
18license is included in the section entitled ``GNU Free Documentation
19License'' in the Emacs manual.
20
21(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
22this GNU Manual, like GNU software. Copies published by the Free
23Software Foundation raise funds for GNU development.''
24
25This document is part of a collection distributed under the GNU Free
26Documentation License. If you want to distribute this document
27separately from the collection, you can do so by adding a copy of the
28license to the document, as described in section 6 of the license.
18f952d5
KB
29@end quotation
30@end copying
31
32@dircategory Emacs
33@direntry
34* Speedbar: (speedbar). File/Tag summarizing utility.
35@end direntry
4e7428f6
EL
36
37@titlepage
38@sp 10
4ea14a3b
DL
39@center @titlefont{Speedbar}
40@sp 2
41@center Eric Ludlam
4e7428f6 42@vskip 0pt plus 1 fill
4ea14a3b
DL
43@page
44@vskip 0pt plus 1filll
18f952d5 45@insertcopying
4e7428f6
EL
46@end titlepage
47
48@node Top, , , (dir)Top
49@comment node-name, next, previous, up
50
4e7428f6
EL
51Speedbar is a program for Emacs which can be used to summarize
52information related to the current buffer. Its original inspiration
18fe4c71 53is the `explorer' often used in modern development environments, office
4e7428f6
EL
54packages, and web browsers.
55
56Speedbar displays a narrow frame in which a tree view is shown. This
57tree view defaults to containing a list of files and directories. Files
18fe4c71 58can be `expanded' to list tags inside. Directories can be expanded to
4e7428f6
EL
59list the files within itself. Each file or tag can be jumped to
60immediately.
61
18fe4c71 62Speedbar expands upon `explorer' windows by maintaining context with the
4e7428f6
EL
63user. For example, when using the file view, the current buffer's file
64is highlighted. Speedbar also mimics the explorer windows by providing
65multiple display modes. These modes come in two flavors. Major display
66modes remain consistent across buffers, and minor display modes appear
f29906f8 67only when a buffer of the applicable type is shown. This allows
4e7428f6
EL
68authors of other packages to provide speedbar summaries customized to
69the needs of that mode.
70
18fe4c71 71Throughout this manual, activities are defined as `clicking on', or
40aa26c1 72`expanding' items. Clicking means using @kbd{Mouse-2} on a
4e7428f6 73button. Expanding refers to clicking on an expansion button to display
f29906f8
EZ
74an expanded summary of the entry the expansion button is
75on. @xref{Basic Navigation}.
4e7428f6
EL
76
77@menu
78* Introduction:: Basics of speedbar.
79* Basic Navigation:: Basics of speedbar common between all modes.
f29906f8
EZ
80* File Mode:: Summarizing files.
81* Buffer Mode:: Summarizing buffers.
4e7428f6 82* Minor Modes:: Additional minor modes such as Info and RMAIL.
f29906f8 83* Customizing:: Changing speedbar behavior.
4e7428f6 84* Extending:: Extend speedbar for your own project.
84247bb5 85* GNU Free Documentation License:: The license for this documentation.
4e7428f6
EL
86* Index::
87@end menu
88
89@node Introduction, Basic Navigation, , Top
90@comment node-name, next, previous, up
91@chapter Introduction
92@cindex introduction
93
339355e3
NR
94To start using speedbar use the command @kbd{M-x speedbar RET} or
95select it from the @samp{Options->Show/Hide} sub-menu. This command
96will open a new frame to summarize the local files. On X Window
97systems or on MS-Windows, speedbar's frame is twenty characters wide,
98and will mimic the height of the frame from which it was started. It
99positions itself to the left or right of the frame you started it
100from.
4e7428f6 101
5e59b0d9 102To use speedbar effectively, it is important to understand its
4e7428f6 103relationship with the frame you started it from. This frame is the
f29906f8
EZ
104@dfn{attached frame} which speedbar will use as a reference point. Once
105started, speedbar watches the contents of this frame, and attempts to
5e59b0d9 106make its contents relevant to the buffer loaded into the attached
4e7428f6
EL
107frame. In addition, all requests made in speedbar that require the
108display of another buffer will display in the attached frame.
109
110When used in terminal mode, the new frame appears the same size as the
111terminal. Since it is not visible while working in the attached frame,
f29906f8
EZ
112speedbar will save time by using the @dfn{slowbar mode}, where no tracking is
113done until speedbar is requested to show itself (i.e., the speedbar's
114frame becomes the selected frame).
4e7428f6 115
f29906f8 116@cindex @code{speedbar-get-focus}
4e7428f6
EL
117The function to use when switching between frames using the keyboard is
118@code{speedbar-get-focus}. This function will toggle between frames, and
f29906f8 119it's useful to bind it to a key in terminal mode. @xref{Customizing}.
4e7428f6
EL
120
121@node Basic Navigation, File Mode, Introduction, Top
122@comment node-name, next, previous, up
123@chapter Basic Navigation
124
125Speedbar can display different types of data, and has several display
126and behavior modes. These modes all have a common behavior, menu
127system, and look. If one mode is learned, then the other modes are easy
128to use.
129
130@menu
47d7776c 131* Basic Key Bindings::
4e7428f6
EL
132* Basic Visuals::
133* Mouse Bindings::
134* Displays Submenu::
135@end menu
136
47d7776c 137@node Basic Key Bindings, Basic Visuals, Basic Navigation, Basic Navigation
4e7428f6 138@comment node-name, next, previous, up
47d7776c
RS
139@section Basic Key Bindings
140@cindex key bindings
4e7428f6 141
47d7776c 142These key bindings are common across all modes:
f29906f8 143
4e7428f6 144@table @kbd
4e7428f6 145@item Q
f29906f8 146@cindex quitting speedbar
4e7428f6
EL
147Quit speedbar, and kill the frame.
148@item q
149Quit speedbar, and hide the frame. This makes it faster to restore the
f29906f8 150speedbar frame, than if you press @kbd{Q}.
4e7428f6 151@item g
f29906f8 152@cindex refresh speedbar display
4e7428f6
EL
153Refresh whatever contents are in speedbar.
154@item t
f29906f8 155@cindex slowbar mode
4e7428f6
EL
156Toggle speedbar to and from slowbar mode. In slowbar mode, frame
157tracking is not done.
f29906f8
EZ
158@item n
159@itemx p
4e7428f6 160@cindex navigation
f29906f8
EZ
161Move, respectively, to the next or previous item. A summary of that
162item will be displayed in the attached frame's minibuffer.
163@item M-n
164@itemx M-p
4e7428f6
EL
165Move to the next or previous item in a restricted fashion. If a list is
166open, the cursor will skip over it. If the cursor is in an open list,
167it will not leave it.
f29906f8
EZ
168@item C-M-n
169@itemx C-M-n
4e7428f6 170Move forwards and backwards across extended groups. This lets you
f29906f8 171quickly skip over all files, directories, or other common sub-items at
4e7428f6
EL
172the same current depth.
173@item C-x b
174Switch buffers in the attached frame.
175@end table
176
177Speedbar can handle multiple modes. Two are provided by default.
178These modes are File mode, and Buffers mode. There are accelerators to
179switch into these different modes.
180
181@cindex mode switching hotkeys
182@table @kbd
183@item b
f29906f8 184Switch into Quick Buffers mode (@pxref{Buffer Mode}). After one use, the
4e7428f6
EL
185previous display mode is restored.
186@item f
f29906f8 187Switch into File mode.
4e7428f6
EL
188@item r
189Switch back to the previous mode.
190@end table
191
192Some modes provide groups, lists and tags. @xref{Basic Visuals}. When
f29906f8 193these are available, some additional common bindings are available.
4e7428f6
EL
194
195@cindex common keys
196@table @kbd
f29906f8
EZ
197@item RET
198@itemx e
4e7428f6
EL
199Edit/Open the current group or tag. This behavior is dependent on the
200mode. In general, files or buffers are opened in the attached frame,
201and directories or group nodes are expanded locally.
f29906f8
EZ
202@item +
203@itemx =
4e7428f6
EL
204Expand the current group, displaying sub items.
205When used with a prefix argument, any data that may have been cached is
f29906f8 206flushed. This is similar to a power click. @xref{Mouse Bindings}.
4e7428f6
EL
207@item -
208Contract the current group, hiding sub items.
209@end table
210
47d7776c 211@node Basic Visuals, Mouse Bindings, Basic Key Bindings, Basic Navigation
4e7428f6
EL
212@comment node-name, next, previous, up
213@section Basic Visuals
214@cindex visuals
215
216Speedbar has visual cues for indicating different types of data. These
217cues are used consistently across the different speedbar modes to make
f29906f8 218them easier to interpret.
4e7428f6 219
f29906f8 220At a high level, in File mode, there are directory buttons, sub
4e7428f6
EL
221directory buttons, file buttons, tag buttons, and expansion buttons.
222This makes it easy to use the mouse to navigate a directory tree, and
223quickly view files, or a summary of those files.
224
5e59b0d9 225The most basic visual effect used to distinguish between these button
4e7428f6 226types is color and mouse highlighting. Anything the mouse highlights
f29906f8 227can be clicked on and is called a button (@pxref{Mouse Bindings}).
4e7428f6
EL
228Anything not highlighted by the mouse will not be clickable.
229
230Text in speedbar consists of four different types of data. Knowing how
231to read these textual elements will make it easier to navigate by
232identifying the types of data available.
233
234@subsubsection Groups
235@cindex groups
236
237Groups summarize information in a single line, and provide a high level
238view of more complex systems, like a directory tree, or manual chapters.
239
240Groups appear at different indentation levels, and are prefixed with a
18fe4c71 241@samp{+} in some sort of `box'. The group name will summarize the
4e7428f6 242information within it, and the expansion box will display that
18fe4c71 243information inline. In File mode, directories and files are `groups'
f29906f8 244where the @samp{+} is surrounded by brackets like this:
4e7428f6
EL
245
246@example
247<+> include
248<-> src
249 [+] foo.c
250@end example
251
252In this example, we see both open and closed directories, in addition to
253a file. The directories have a box consisting of angle brackets, and a
254file uses square brackets.
255
18fe4c71 256In all modes, a group can be `edited' by pressing @kbd{RET}, meaning a
4e7428f6
EL
257file will be opened, or a directory explicitly opened in speedbar. A
258group can be expanded or contracted using @kbd{+} or
47d7776c 259@kbd{-}. @xref{Basic Key Bindings}.
4e7428f6 260
5e59b0d9 261Sometimes groups may have a @samp{?} in its indicator box. This means
4e7428f6
EL
262that it is a group type, but there are no contents, or no known way of
263extracting contents of that group.
264
265When a group has been expanded, the indicator button changes from
f29906f8
EZ
266@samp{+} to @samp{-}. This indicates that the contents are being shown.
267Click the @samp{-} button to contract the group, or hide the contents
4e7428f6
EL
268currently displayed.
269
270@subsubsection Tags
271@cindex tags
272
273Tags are the leaf nodes of the tree system. Tags are generally prefixed
f29906f8 274with a simple character, such as @samp{>}. Tags can only be jumped to using
4e7428f6
EL
275@kbd{RET} or @kbd{e}.
276
277@subsubsection Boolean Flags
278
279Sometimes a group or tag is given a boolean flag. These flags appear as
f29906f8
EZ
280extra text characters at the end of the line. File mode uses boolean
281flags, such as a @samp{*} to indicate that a file has been checked out
4e7428f6
EL
282of a versioning system.
283
f29906f8 284For additional flags, see
4e7428f6 285@c Note to self, update these to sub-nodes which are more relevant.
f29906f8 286@ref{File Mode}, and @ref{Version Control}.
4e7428f6
EL
287
288@subsubsection Unadorned Text
289
290Unadorned text generally starts in column 0, without any special symbols
f29906f8 291prefixing them. In Buffers mode different buffer groups are prefixed
4e7428f6
EL
292with a description of what the following buffers are (Files, scratch
293buffers, and invisible buffers.)
294
f29906f8 295Unadorned text will generally be colorless, and not clickable.
4e7428f6
EL
296
297@subsubsection Color Cues
298
299Each type of Group, item indicator, and label is given a different
f29906f8
EZ
300color. The colors chosen are dependent on whether the background color
301is light or dark.
18fe4c71 302Of important note is that the `current item', which may be a buffer or
4e7428f6
EL
303file name, is highlighted red, and underlined.
304
305Colors can be customized from the group @code{speedbar-faces}. Some
306modes, such as for Info, will use the Info colors instead of default
307speedbar colors as an indication of what is currently being displayed.
308
309The face naming convention mirrors the File display mode. Modes which
310do not use files will attempt to use the same colors on analogous
311entries.
312
313@node Mouse Bindings, Displays Submenu, Basic Visuals, Basic Navigation
314@comment node-name, next, previous, up
315@section Mouse Bindings
316@cindex mouse bindings
317
318The mouse has become a common information navigation tool. Speedbar
319will use the mouse to navigate file systems, buffer lists, and other
320data. The different textual cues provide buttons which can be clicked
f29906f8 321on (@pxref{Basic Visuals}). Anything that highlights can be clicked on
5e59b0d9 322with the mouse, or affected by the menu.
4e7428f6
EL
323
324The mouse bindings are:
f29906f8 325
4e7428f6 326@table @kbd
e5811d71 327@item Mouse-1
f29906f8 328Move cursor to that location.
e5811d71
RS
329@item Mouse-2
330@itemx Double-Mouse-1
331Activate the current button. @kbd{Double-Mouse-1} is called a @dfn{double
f29906f8 332click} on other platforms, and is useful for windows users with two
4e7428f6 333button mice.
e5811d71
RS
334@c Isn't it true that with two-button mice, the right button is Mouse-2?
335@c On GNU/Linux, the right button is Mouse-3.
336@item S-Mouse-2
337@itemx S-Double-Mouse-1
4e7428f6 338@cindex power click
e5811d71 339This has the same effect as @kbd{Mouse-2}, except it is called a power
f29906f8 340click. This means that if a group with an expansion button @samp{+} is
4e7428f6
EL
341clicked, any caches are flushed, and subitems re-read. If it is a name,
342it will be opened in a new frame.
e5811d71 343@item Mouse-3
5e59b0d9 344Activate the speedbar menu. The item selected affects the line clicked,
4e7428f6 345not the line where the cursor was.
e5811d71 346@item Mouse-1 @r{(mode line)}
f29906f8 347Activate the menu. This affects the item the cursor is on before the
4e7428f6 348click, since the mouse was not clicked on anything.
e5811d71 349@item C-Mouse-1
4e7428f6
EL
350Buffers sub-menu. The buffer in the attached frame is switched.
351@end table
352
353When the mouse moves over buttons in speedbar, details of that item
354should be displayed in the minibuffer of the attached frame. Sometimes
355this can contain extra information such as file permissions, or tag
356location.
357
358@node Displays Submenu, , Mouse Bindings, Basic Navigation
359@comment node-name, next, previous, up
360@section Displays Submenu
361@cindex displays submenu
362
363You can display different data by using different display modes. These
f29906f8 364specialized modes make it easier to navigate the relevant pieces of
4e7428f6
EL
365information, such as files and directories, or buffers.
366
e5811d71
RS
367In the main menu, found by clicking @kbd{Mouse-3}, there is a submenu
368labeled @samp{Displays}. This submenu lets you easily choose between
4e7428f6
EL
369different display modes.
370
371The contents are modes currently loaded into emacs. By default, this
372would include Files, Quick Buffers, and Buffers. Other major display
373modes such as Info are loaded separately.
374
375@node File Mode, Buffer Mode, Basic Navigation, Top
376@comment node-name, next, previous, up
377@chapter File Mode
378@cindex file mode
379
380File mode displays a summary of your current directory. You can display
381files in the attached frame, or summarize the tags found in files. You
382can even see if a file is checked out of a version control system, or
383has some associated object file.
384
f29906f8 385Advanced behavior, like copying and renaming files, is also provided.
4e7428f6
EL
386
387@menu
388* Directory Display:: What the display means.
389* Hidden Files:: How to display hidden files.
47d7776c 390* File Key Bindings:: Performing file operations.
4e7428f6
EL
391@end menu
392
393@node Directory Display, Hidden Files, File Mode, File Mode
394@comment node-name, next, previous, up
395@section Directory Display
396@cindex directory display
397
398There are three major sections in the display. The first line or two is
399the root directory speedbar is currently viewing. You can jump to one
400of the parent directories by clicking on the name of the directory you
401wish to jump to.
402
403Next, directories are listed. A directory starts with the group
f29906f8 404indicator button @samp{<+>}. Clicking the directory name makes speedbar
4e7428f6 405load that directory as the root directory for its display. Clicking the
f29906f8 406@samp{<+>} button will list all directories and files beneath.
4e7428f6 407
f29906f8
EZ
408Next, files are listed. Files start with the group indicator @samp{[+]}
409or @samp{[?]}. You can jump to a file in the attached frame by clicking
410on the file name. You can expand a file and look at its tags by
411clicking on the @samp{[+]} symbol near the file name.
4e7428f6
EL
412
413A typical session might look like this:
f29906f8 414
4e7428f6
EL
415@example
416~/lisp/
417<+> checkdoc
418<+> eieio
419<-> speedbar
420 [+] Makefile
421 [+] rpm.el #
422 [+] sb-gud.el #
423 [+] sb-info.el #
424 [+] sb-rmail.el #
425 [+] sb-w3.el
426 [-] speedbar.el *!
427 @{+@} Types
428 @{+@} Variables
429 @{+@} def (group)
430 @{+@} speedbar-
431 [+] speedbar.texi *
432<+> testme
433[+] align.el
434[+] autoconf.el
435@end example
436
437In this example, you can see several directories. The directory
438@file{speedbar} has been opened inline. Inside the directory
f29906f8 439@file{speedbar}, the file @file{speedbar.el} has its tags exposed.
4e7428f6
EL
440These tags are extensive, and they are summarized into tag groups.
441
442Files get additional boolean flags associated with them. Valid flags are:
f29906f8 443
4e7428f6
EL
444@cindex file flags
445@table @code
446@item *
447This file has been checked out of a version control
f29906f8
EZ
448system. @xref{Version Control}.
449@cindex @code{speedbar-obj-alist}
4e7428f6
EL
450@item #
451This file has an up to date object file associated with it. The
452variable @code{speedbar-obj-alist} defines how speedbar determines this
453value.
454@item !
455This file has an out of date object file associated with it.
456@end table
457
458A Tag group is prefixed with the symbol @samp{@{+@}}. Clicking this
459symbol will show all symbols that have been organized into that group.
460Different types of files have unique tagging methods as defined by their
f29906f8
EZ
461major mode. Tags are generated with either the @code{imenu} package, or
462through the @code{etags} interface.
4e7428f6
EL
463
464Tag groups are defined in multiple ways which make it easier to find the
465tag you are looking for. Imenu keywords explicitly create groups, and
466speedbar will automatically create groups if tag lists are too long.
467
468In our example, Imenu created the groups @samp{Types} and
469@samp{Variables}. All remaining top-level symbols are then regrouped
470based on the variable @code{speedbar-tag-hierarchy-method}. The
471subgroups @samp{def} and @samp{speedbar-} are groupings where the first
472few characters of the given symbols are specified in the group name.
473Some group names may say something like @samp{speedbar-t to speedbar-v},
474indicating that all symbols which alphabetically fall between those
5e59b0d9 475categories are included in that sub-group. @xref{Tag Hierarchy Methods}.
4e7428f6 476
47d7776c 477@node Hidden Files, File Key Bindings, Directory Display, File Mode
4e7428f6
EL
478@comment node-name, next, previous, up
479@section Hidden Files
480@cindex hidden files
481
892c6176
RS
482On GNU and Unix systems, a hidden file is a file whose name starts
483with a period. They are hidden from a regular directory listing
484because the user is not generally interested in them.
4e7428f6
EL
485
486In speedbar, a hidden file is a file which isn't very interesting and
487might prove distracting to the user. Any uninteresting files are
f29906f8 488removed from the File display. There are two levels of uninterest in
4e7428f6
EL
489speedbar. The first level of uninterest are files which have no
490expansion method, or way of extracting tags. The second level is any
491file that matches the same pattern used for completion in
492@code{find-file}. This is derived from the variable
493@code{completion-ignored-extensions}.
494
495You can toggle the display of uninteresting files from the toggle menu
f29906f8
EZ
496item @samp{Show All Files}. This will display all level one hidden files.
497These files will be shown with a @samp{?} indicator. Level 2 hidden
4e7428f6
EL
498files will still not be shown.
499
f29906f8
EZ
500Object files fall into the category of level 2 hidden files. You can
501determine their presence by the @samp{#} and @samp{!} file indicators.
4e7428f6
EL
502@xref{Directory Display}.
503
47d7776c 504@node File Key Bindings, , Hidden Files, File Mode
4e7428f6 505@comment node-name, next, previous, up
47d7776c
RS
506@section File Key Bindings
507@cindex file key bindings
4e7428f6 508
47d7776c 509File mode has key bindings permitting different file system operations
f29906f8
EZ
510such as copy or rename. These commands all operate on the @dfn{current
511file}. In this case, the current file is the file at point, or clicked
4e7428f6
EL
512on when pulling up the menu.
513
514@table @kbd
515@item U
516Move the entire speedbar display up one directory.
517@item I
518Display information in the minibuffer about this line. This is the same
519information shown when navigating with @kbd{n} and @kbd{p}, or moving
520the mouse over an item.
521@item B
522Byte compile the Emacs Lisp file on this line.
523@item L
f29906f8
EZ
524Load the Emacs Lisp file on this line. If a @file{.elc} file exists,
525optionally load that.
4e7428f6
EL
526@item C
527Copy the current file to some other location.
528@item R
529Rename the current file, possibly moving it to some other location.
530@item D
531Delete the current file.
532@item O
533Delete the current file's object file. Use the symbols @samp{#} and
534@samp{!} to determine if there is an object file available.
535@end table
536
537One menu item toggles the display of all available files. By default,
538only files which Emacs understands, and knows how to convert into a tag
f29906f8 539list, are shown. By showing all files, additional files such as text files are
4e7428f6 540also displayed, but they are prefixed with the @samp{[?]} symbol. This
f29906f8 541means that it is a file, but Emacs doesn't know how to expand it.
4e7428f6
EL
542
543@node Buffer Mode, Minor Modes, File Mode, Top
544@comment node-name, next, previous, up
545@chapter Buffer Mode
546@cindex buffer mode
547
f29906f8 548Buffer mode is very similar to File mode, except that instead of
4e7428f6 549tracking the current directory and all files available there, the
f29906f8 550current list of Emacs buffers is shown.
4e7428f6 551
f29906f8
EZ
552These buffers can have their tags expanded in the same way as files,
553and uses the same unknown file indicator (@pxref{File Mode}).
4e7428f6 554
f29906f8 555Buffer mode does not have file operation bindings, but the following
47d7776c 556buffer specific key bindings are available:
f29906f8 557
4e7428f6
EL
558@table @kbd
559@item k
f29906f8 560Kill this buffer. Do not touch its file.
4e7428f6
EL
561@item r
562Revert this buffer, reloading from disk.
563@end table
564
f29906f8 565In addition to Buffer mode, there is also Quick Buffer mode. In fact,
4e7428f6 566Quick Buffers is bound to the @kbd{b} key. The only difference between
f29906f8 567Buffers and Quick Buffers is that after one operation is performed
5e59b0d9 568which affects the attached frame, the display is immediately reverted to
4e7428f6
EL
569the last displayed mode.
570
f29906f8 571Thus, if you are in File mode, and you need quick access to a buffer,
4e7428f6 572press @kbd{b}, click on the buffer you want, and speedbar will revert
f29906f8 573back to File mode.
4e7428f6
EL
574
575@node Minor Modes, Customizing, Buffer Mode, Top
576@comment node-name, next, previous, up
577@chapter Minor Display Modes
578@cindex minor display modes
579
580For some buffers, a list of files and tags makes no sense. This could
581be because files are not currently in reference (such as web pages), or
582that the files you might be interested have special properties (such as
583email folders.)
584
585In these cases, a minor display mode is needed. A minor display mode
586will override any major display mode currently being displayed for the
587duration of the specialized buffer's use. Minor display modes
588will follow the general rules of their major counterparts in terms of
47d7776c 589key bindings and visuals, but will have specialized behaviors.
4e7428f6
EL
590
591@menu
ec79de10
NR
592* RMAIL:: Managing folders.
593* Info:: Browsing topics.
594* GDB:: Watching expressions or managing the current
595 stack trace.
4e7428f6
EL
596@end menu
597
598@node RMAIL, Info, Minor Modes, Minor Modes
599@comment node-name, next, previous, up
600@section RMAIL
601@cindex RMAIL
602
603When using RMAIL, speedbar will display two sections. The first is a
604layer one reply button. Clicking here will initialize a reply buffer
605showing only this email address in the @samp{To:} field.
606
607The second section lists all RMAIL folders in the same directory as your
608main RMAIL folder. The general rule is that RMAIL folders always appear
609in all caps, or numbers. It is possible to save mail in folders with
f29906f8 610lower case letters, but there is no clean way of detecting such RMAIL folders
4e7428f6
EL
611without opening them all.
612
613Each folder can be visited by clicking the name. You can move mail from
614the current RMAIL folder into a different folder by clicking the
f29906f8 615@samp{<M>} button. The @samp{M} stands for Move.
4e7428f6
EL
616
617In this way you can manage your existing RMAIL folders fairly easily
618using the mouse.
619
620@node Info, GDB, RMAIL, Minor Modes
621@comment node-name, next, previous, up
622@section Info
623@cindex Info
624
625When browsing Info files, all local relevant information is displayed in
626the info buffer and a topical high-level view is provided in speedbar.
627All top-level info nodes are shown in the speedbar frame, and can be
628jumped to by clicking the name.
629
630You can open these nodes with the @samp{[+]} button to see what sub-topics
631are available. Since these sub-topics are not examined until you click
632the @samp{[+]} button, sometimes a @samp{[?]} will appear when you click on
633a @samp{[+]}, indicating that there are no sub-topics.
634
635@node GDB, , Info, Minor Modes
636@comment node-name, next, previous, up
637@section GDB
638@cindex gdb
639@cindex gud
640
ec79de10
NR
641You can debug an application with GDB in Emacs using graphical mode or
642text command mode (@pxref{GDB Graphical Interface,,, emacs, The
643extensible self-documenting text editor}).
644
645If you are using graphical mode you can see how selected variables
646change each time your program stops (@pxref{Watch Expressions,,,
647emacs, The extensible self-documenting text editor}).
648
649If you are using text command mode, speedbar can show
4e7428f6
EL
650you the current stack when the current buffer is the @file{*gdb*}
651buffer. Usually, it will just report that there is no stack, but when
652the application is stopped, the current stack will be shown.
653
654You can click on any stack element and gdb will move to that stack
655level. You can then check variables local to that level at the GDB
656prompt.
657
4e7428f6
EL
658@node Customizing, Extending, Minor Modes, Top
659@comment node-name, next, previous, up
660@chapter Customizing
661@cindex customizing
662
663Speedbar is highly customizable, with a plethora of control elements.
664Since speedbar is so visual and reduces so much information, this is an
f29906f8 665important aspect of its behavior.
4e7428f6
EL
666
667In general, there are three custom groups you can use to quickly modify
668speedbar's behavior.
669
670@table @code
671@item speedbar
672Basic speedbar behaviors.
673@item speedbar-vc
674Customizations regarding version control handling.
675@item speedbar-faces
676Customize speedbar's many colors and fonts.
677@end table
678
679@menu
680* Frames and Faces:: Visible behaviors.
681* Tag Hierarchy Methods:: Customizing how tags are displayed.
682* Version Control:: Adding new VC detection modes.
683* Hooks:: The many hooks you can use.
684@end menu
685
686@node Frames and Faces, Tag Hierarchy Methods, Customizing, Customizing
687@comment node-name, next, previous, up
688@section Frames and Faces
689@cindex faces
690@cindex frame parameters
691
692There are several faces speedbar generates to provide a consistent
f29906f8 693color scheme across display types. You can customize these faces using
4e7428f6
EL
694your favorite method. They are:
695
696@table @asis
f29906f8 697@cindex @code{speedbar-button-face}
4e7428f6 698@item speedbar-button-face
f29906f8
EZ
699Face used on expand/contract buttons.
700@cindex @code{speedbar-file-face}
4e7428f6
EL
701@item speedbar-file-face
702Face used on Files. Should also be used on non-directory like nodes.
f29906f8 703@cindex @code{speedbar-directory-face}
4e7428f6
EL
704@item speedbar-directory-face
705Face used for directories, or nodes which consist of groups of other nodes.
f29906f8 706@cindex @code{speedbar-tag-face}
4e7428f6 707@item speedbar-tag-face
f29906f8
EZ
708Face used for tags in a file, or for leaf items.
709@cindex @code{speedbar-selected-face}
4e7428f6 710@item speedbar-selected-face
f29906f8 711Face used to highlight the selected item. This would be the current
4e7428f6 712file being edited.
f29906f8 713@cindex @code{speedbar-highlight-face}
4e7428f6
EL
714@item speedbar-highlight-face
715Face used when the mouse passes over a button.
716@end table
717
718You can also customize speedbar's initial frame parameters. How this is
719accomplished is dependent on your platform being Emacs or XEmacs.
720
f29906f8 721@cindex @code{speedbar-frame-parameters}, Emacs
4e7428f6
EL
722In Emacs, change the alist @code{speedbar-frame-parameters}. This
723variable is used to set up initial details. Height is also
724automatically added when speedbar is created, though you can override
725it.
726
f29906f8 727@cindex @code{speedbar-frame-plist}, XEmacs
4e7428f6
EL
728In XEmacs, change the plist @code{speedbar-frame-plist}. This is the
729XEmacs way of doing the same thing.
730
731@node Tag Hierarchy Methods, Version Control, Frames and Faces, Customizing
732@comment node-name, next, previous, up
733@section Tag Hierarchy Methods
734@cindex tag hierarchy
735@cindex tag groups
736@cindex tag sorting
737
738When listing tags within a file, it is possible to get an annoyingly
739long list of entries. Imenu (which generates the tag list in Emacs)
740will group some classes of items automatically. Even here, however,
741some tag groups can be quite large.
742
f29906f8 743@cindex @code{speedbar-tag-hierarchy-method}
4e7428f6
EL
744To solve this problem, tags can be grouped into logical units through a
745hierarchy processor. The specific variable to use is
746@code{speedbar-tag-hierarchy-method}. There are several methods that
f29906f8 747can be applied in any order. They are:
4e7428f6
EL
748
749@table @code
f29906f8 750@cindex @code{speedbar-trim-words-tag-hierarchy}
4e7428f6
EL
751@item speedbar-trim-words-tag-hierarchy
752Find a common prefix for all elements of a group, and trim it off.
f29906f8 753@cindex @code{speedbar-prefix-group-tag-hierarchy}
4e7428f6
EL
754@item speedbar-prefix-group-tag-hierarchy
755If a group is too large, place sets of tags into bins based on common
756prefixes.
f29906f8 757@cindex @code{speedbar-simple-group-tag-hierarchy}
4e7428f6
EL
758@item speedbar-simple-group-tag-hierarchy
759Take all items in the top level list not in a group, and stick them into
f29906f8
EZ
760a @samp{Tags} group.
761@cindex @code{speedbar-sort-tag-hierarchy}
4e7428f6
EL
762@item speedbar-sort-tag-hierarchy
763Sort all items, leaving groups on top.
764@end table
765
766You can also add your own functions to reorganize tags as you see fit.
767
768Some other control variables are:
769
770@table @code
f29906f8 771@cindex @code{speedbar-tag-group-name-minimum-length}
4e7428f6 772@item speedbar-tag-group-name-minimum-length
f29906f8 773Default value: 4.
4e7428f6
EL
774
775The minimum length of a prefix group name before expanding. Thus, if
776the @code{speedbar-tag-hierarchy-method} includes
777@code{speedbar-prefix-group-tag-hierarchy} and one such group's common
778characters is less than this number of characters, then the group name
779will be changed to the form of:
780
781@example
782worda to wordb
783@end example
784
785instead of just
786
787@example
788word
789@end example
790
791This way we won't get silly looking listings.
792
f29906f8 793@cindex @code{speedbar-tag-split-minimum-length}
4e7428f6 794@item speedbar-tag-split-minimum-length
f29906f8 795Default value: 20.
4e7428f6
EL
796
797Minimum length before we stop trying to create sub-lists in tags.
798This is used by all tag-hierarchy methods that break large lists into
799sub-lists.
800
f29906f8 801@cindex @code{speedbar-tag-regroup-maximum-length}
4e7428f6 802@item speedbar-tag-regroup-maximum-length
f29906f8 803Default value: 10.
4e7428f6
EL
804
805Maximum length of submenus that are regrouped.
806If the regrouping option is used, then if two or more short subgroups
807are next to each other, then they are combined until this number of
808items is reached.
4e7428f6
EL
809@end table
810
811@node Version Control, Hooks, Tag Hierarchy Methods, Customizing
812@comment node-name, next, previous, up
813@section Version Control
814@cindex version control
815@cindex vc extensions
816
f29906f8 817When using the file mode in speedbar, information regarding a version
4e7428f6 818control system adds small details to the display. If a file is in a
e5811d71
RS
819version control system, and is ``checked out'' or ``locked'' locally, an
820asterisk @samp{*} appears at the end of the file name. In addition,
4e7428f6
EL
821the directory name for Version Control systems are left out of the
822speedbar display.
823
f29906f8 824@cindex @code{speedbar-directory-unshown-regexp}
4e7428f6 825You can easily add new version control systems into speedbar's detection
f29906f8 826scheme. To make a directory ``disappear'' from the list, use the variable
4e7428f6
EL
827@code{speedbar-directory-unshown-regexp}.
828
f29906f8 829@cindex @code{speedbar-vc-path-enable-hook}
4e7428f6
EL
830Next, you need to write entries for two hooks. The first is
831@code{speedbar-vc-path-enable-hook} which will enable a VC check in the
832current directory for the group of files being checked. Your hook
833function should take one parameter (the directory to check) and return
834@code{t} if your VC method is in control here.
835
f29906f8 836@cindex @code{speedbar-vc-in-control-hook}
4e7428f6 837The second function is @code{speedbar-vc-in-control-hook}. This hook
f29906f8
EZ
838takes two parameters, the @var{path} of the file to check, and the
839@var{file} name. Return @code{t} if you want to have the asterisk
4e7428f6
EL
840placed near this file.
841
f29906f8 842@cindex @code{speedbar-vc-indicator}
4e7428f6
EL
843Lastly, you can change the VC indicator using the variable
844@code{speedbar-vc-indicator}, and specify a single character string.
845
846@node Hooks, , Version Control, Customizing
847@comment node-name, next, previous, up
848@section Hooks
f29906f8 849@cindex hooks
4e7428f6
EL
850
851There are several hooks in speedbar allowing custom behaviors to be
852added. Available hooks are:
853
854@table @code
f29906f8 855@cindex @code{speedbar-visiting-file-hook}
4e7428f6
EL
856@item speedbar-visiting-file-hook
857Hooks run when speedbar visits a file in the selected frame.
f29906f8 858@cindex @code{speedbar-visiting-tag-hook}
4e7428f6
EL
859@item speedbar-visiting-tag-hook
860Hooks run when speedbar visits a tag in the selected frame.
f29906f8 861@cindex @code{speedbar-load-hook}
4e7428f6
EL
862@item speedbar-load-hook
863Hooks run when speedbar is loaded.
f29906f8 864@cindex @code{speedbar-reconfigure-keymaps-hook}
4e7428f6
EL
865@item speedbar-reconfigure-keymaps-hook
866Hooks run when the keymaps are regenerated. Keymaps are reconfigured
47d7776c 867whenever modes change. This will let you add custom key bindings.
f29906f8 868@cindex @code{speedbar-before-popup-hook}
4e7428f6
EL
869@item speedbar-before-popup-hook
870Hooks called before popping up the speedbar frame.
f29906f8 871New frames are often popped up when ``power clicking'' on an item to view
4e7428f6 872it.
f29906f8 873@cindex @code{speedbar-before-delete-hook}
4e7428f6
EL
874@item speedbar-before-delete-hook
875Hooks called before deleting or hiding the speedbar frame.
f29906f8 876@cindex @code{speedbar-mode-hook}
4e7428f6
EL
877@item speedbar-mode-hook
878Hooks called after creating a speedbar buffer.
f29906f8 879@cindex @code{speedbar-timer-hook}
4e7428f6
EL
880@item speedbar-timer-hook
881Hooks called after running the speedbar timer function.
f29906f8 882@cindex @code{speedbar-scanner-reset-hook}
4e7428f6
EL
883@item speedbar-scanner-reset-hook
884Hook called whenever generic scanners are reset.
f29906f8 885Set this to implement your own scanning or rescan safe functions with
4e7428f6
EL
886state data.
887@end table
888
84247bb5 889@node Extending, GNU Free Documentation License, Customizing, Top
4e7428f6
EL
890@comment node-name, next, previous, up
891@chapter Extending
892@cindex extending
893
894Speedbar can run different types of Major display modes such as Files
f29906f8 895(@pxref{File Mode}), and Buffers (@pxref{Buffer Mode}). It can also manage
4e7428f6
EL
896different minor display modes for use with buffers handling specialized
897data.
898
899These major and minor display modes are handled through an extension
900system which permits specialized keymaps and menu extensions, in
901addition to a unique rendering function. You can also specify a wide
f29906f8 902range of tagging functions. The default uses @code{imenu}, but new
5e59b0d9 903tagging methods can be easily added. In this chapter, you will
4e7428f6
EL
904learn how to write your own major or minor display modes, and how to
905create specialized tagging functions.
906
907@menu
908* Minor Display Modes:: How to create a minor display mode.
909* Major Display Modes:: How to create a major display mode.
5e59b0d9 910* Tagging Extensions:: How to create your own tagging methods.
4e7428f6
EL
911* Creating a display:: How to insert buttons and hierarchies.
912@end menu
913
914@node Minor Display Modes, Major Display Modes, Extending, Extending
915@section Minor Display Modes
916@cindex create minor display mode
917
f29906f8 918A @dfn{minor display mode} is a mode useful when using a specific type of
4e7428f6
EL
919buffer. This mode might not be useful for any other kind of data or
920mode, or may just be more useful that a files or buffers based mode when
921working with a specialized mode.
922
923Examples that already exist for speedbar include RMAIL, Info, and gdb.
924These modes display information specific to the major mode shown in the
925attached frame.
926
927To enable a minor display mode in your favorite Major mode, follow these
f29906f8 928steps. The string @samp{@var{name}} is the name of the major mode being
4e7428f6
EL
929augmented with speedbar.
930
931@enumerate
932@item
f29906f8
EZ
933Create the keymap variable @code{@var{name}-speedbar-key-map}.
934
4e7428f6 935@item
f29906f8 936Create a function, named whatever you like, which assigns values into your
4e7428f6
EL
937keymap. Use this command to create the keymap before assigning
938bindings:
f29906f8
EZ
939
940@smallexample
941 (setq @var{name}-speedbar-key-map (speedbar-make-specialized-keymap))
942@end smallexample
943
4e7428f6 944This function creates a special keymap for use in speedbar.
f29906f8 945
4e7428f6
EL
946@item
947Call your install function, or assign it to a hook like this:
f29906f8
EZ
948
949@smallexample
4e7428f6 950(if (featurep 'speedbar)
f29906f8
EZ
951 (@var{name}-install-speedbar-variables)
952 (add-hook 'speedbar-load-hook '@var{name}-install-speedbar-variables))
953@end smallexample
954
4e7428f6 955@item
f29906f8
EZ
956Create an easymenu compatible vector named
957@code{@var{name}-speedbar-menu-items}. This will be spliced into
958speedbar's control menu.
959
4e7428f6 960@item
f29906f8 961Create a function called @code{@var{name}-speedbar-buttons}. This function
4e7428f6
EL
962should take one variable, which is the buffer for which it will create
963buttons. At this time @code{(current-buffer)} will point to the
964uncleared speedbar buffer.
965@end enumerate
966
f29906f8 967When writing @code{@var{name}-speedbar-buttons}, the first thing you will
4e7428f6
EL
968want to do is execute a check to see if you need to re-create your
969display. If it needs to be cleared, you need to erase the speedbar
f29906f8 970buffer yourself, and start drawing buttons. @xref{Creating a display}.
4e7428f6 971
5e59b0d9 972@node Major Display Modes, Tagging Extensions, Minor Display Modes, Extending
4e7428f6
EL
973@section Major Display Modes
974@cindex create major display mode
975
f29906f8 976Creating a @dfn{Major Display Mode} for speedbar requires authoring a keymap,
4e7428f6
EL
977an easy-menu segment, and writing several functions. These items can be
978given any name, and are made the same way as in a minor display mode
f29906f8 979(@pxref{Minor Display Modes}). Once this is done, these items need to be
4e7428f6
EL
980registered.
981
982Because this setup activity may or may not have speedbar available when
983it is being loaded, it is necessary to create an install function. This
984function should create and initialize the keymap, and add your
985expansions into the customization tables.
986
f29906f8 987@cindex @code{speedbar-make-specialized-keymap}
4e7428f6
EL
988When creating the keymap, use the function
989@code{speedbar-make-specialized-keymap} instead of other keymap making
990functions. This will provide you with the initial bindings needed.
991Some common speedbar functions you might want to bind are:
992
993@table @code
f29906f8 994@cindex @code{speedbar-edit-line}
4e7428f6
EL
995@item speedbar-edit-line
996Edit the item on the current line.
f29906f8 997@cindex @code{speedbar-expand-line}
4e7428f6
EL
998@item speedbar-expand-line
999Expand the item under the cursor.
f29906f8
EZ
1000With a numeric argument (@kbd{C-u}), flush cached data before expanding.
1001@cindex @code{speedbar-contract-line}
4e7428f6
EL
1002@item speedbar-contract-line
1003Contract the item under the cursor.
1004@end table
1005
f29906f8 1006@cindex @code{speedbar-line-path}
4e7428f6
EL
1007These function require that function @code{speedbar-line-path} be
1008correctly overloaded to work.
1009
1010Next, register your extension like this;
1011
1012@example
1013 (speedbar-add-expansion-list '("MyExtension"
1014 MyExtension-speedbar-menu-items
1015 MyExtension-speedbar-key-map
1016 MyExtension-speedbar-buttons))
1017@end example
1018
1019There are no limitations to the names you use.
1020
1021The first parameter is the string representing your display mode.
1022The second parameter is a variable name containing an easymenu compatible
1023menu definition. This will be stuck in the middle of speedbar's menu.
1024The third parameter is the variable name containing the keymap we
1025discussed earlier.
1026The last parameter is a function which draws buttons for your mode.
1027This function must take two parameters. The directory currently being
1028displayed, and the depth at which you should start rendering buttons.
1029The function will then draw (starting at the current cursor position)
1030any buttons deemed necessary based on the input parameters.
1031@xref{Creating a display}.
1032
1033Next, you need to register function overrides. This may look something
1034like this:
1035
1036@example
1037(speedbar-add-mode-functions-list
1038 '("MYEXTENSION"
1039 (speedbar-item-info . MyExtension-speedbar-item-info)
1040 (speedbar-line-path . MyExtension-speedbar-line-path)))
1041@end example
1042
1043The first element in the list is the name of you extension. The second
1044is an alist of functions to overload. The function to overload is
1045first, followed by what you want called instead.
1046
1047For @code{speedbar-line-path} your function should take an optional DEPTH
1048parameter. This is the starting depth for heavily indented lines. If
1049it is not provided, you can derive it like this:
1050
1051@example
1052(save-match-data
1053 (if (not depth)
1054 (progn
1055 (beginning-of-line)
1056 (looking-at "^\\([0-9]+\\):")
1057 (setq depth (string-to-int (match-string 1)))))
1058@end example
1059
f29906f8 1060@noindent
4e7428f6
EL
1061where the depth is stored as invisible text at the beginning of each
1062line.
1063
1064The path returned should be the full path name of the file associated
1065with that line. If the cursor is on a tag, then the file containing
1066that tag should be returned. This is critical for built in file based
1067functions to work (meaning less code for you to write). If your display
1068does not deal in files, you do not need to overload this function.
1069
f29906f8 1070@cindex @code{speedbar-item-info}
4e7428f6
EL
1071The function @code{speedbar-item-info}, however, is very likely to need
1072overloading. This function takes no parameters and must derive a text
1073summary to display in the minibuffer.
1074
1075There are several helper functions you can use if you are going to use
1076built in tagging. These functions can be @code{or}ed since each one
49e6099b 1077returns non-@code{nil} if it displays a message. They are:
4e7428f6
EL
1078
1079@table @code
f29906f8 1080@cindex @code{speedbar-item-info-file-helper}
4e7428f6 1081@item speedbar-item-info-file-helper
f29906f8 1082This takes an optional @var{filename} parameter. You can derive your own
4e7428f6
EL
1083filename, or it will derive it using a (possibly overloaded) function
1084@code{speedbar-line-file}. It shows details about a file.
f29906f8 1085@cindex @code{speedbar-item-info-tag-helper}
4e7428f6
EL
1086@item speedbar-item-info-tag-helper
1087If the current line is a tag, then display information about that tag,
f29906f8 1088such as its parent file, and location.
4e7428f6
EL
1089@end table
1090
1091Your custom function might look like this:
1092
f29906f8 1093@example
4e7428f6
EL
1094(defun MyExtension-item-info ()
1095 "Display information about the current line."
1096 (or (speedbar-item-info-tag-helper)
1097 (message "Interesting detail.")))
f29906f8 1098@end example
4e7428f6
EL
1099
1100Once you have done all this, speedbar will show an entry in the
f29906f8 1101@samp{Displays} menu declaring that your extension is available.
4e7428f6 1102
5e59b0d9
DL
1103@node Tagging Extensions, Creating a display, Major Display Modes, Extending
1104@section Tagging Extensions
4e7428f6
EL
1105
1106It is possible to create new methods for tagging files in speedbar.
f29906f8
EZ
1107To do this, you need two basic functions, one function to fetch the
1108tags from a buffer, the other to insert them below the filename.
4e7428f6
EL
1109
1110@defun my-fetch-dynamic-tags file
f29906f8 1111Parse @var{file} for a list of tags. Return the list, or @code{t} if there was
4e7428f6
EL
1112an error.
1113@end defun
1114
1115The non-error return value can be anything, as long as it can be
5e59b0d9 1116inserted by its paired function:
4e7428f6
EL
1117
1118@defun my-insert-tag-list level lst
1119Insert a list of tags @var{lst} started at indentation level
1120@var{level}. Creates buttons for each tag, and provides any other
5e59b0d9 1121display information required.
4e7428f6
EL
1122@end defun
1123
f29906f8 1124@cindex @code{speedbar-create-tag-hierarchy}
4e7428f6 1125It is often useful to use @code{speedbar-create-tag-hierarchy} on your
f29906f8 1126token list. See that function's documentation for details on what it
4e7428f6
EL
1127requires.
1128
f29906f8 1129@cindex @code{speedbar-dynamic-tags-function-list}
4e7428f6
EL
1130Once these two functions are written, modify the variable
1131@code{speedbar-dynamic-tags-function-list} to include your parser at the
1132beginning, like this:
1133
1134@example
1135(add-to-list 'speedbar-dynamic-tags-function-list
1136 '(my-fetch-dynamic-tags . my-insert-tag-list))
1137@end example
1138
1139If your parser is only good for a few types of files, make sure that it
1140is either a buffer local modification, or that the tag generator returns
f29906f8 1141@code{t} for non valid buffers.
4e7428f6 1142
5e59b0d9 1143@node Creating a display, , Tagging Extensions, Extending
4e7428f6
EL
1144@section Creating a display
1145@cindex creating a display
1146
1147Rendering a display in speedbar is completely flexible. When your
f29906f8 1148button function is called, see @ref{Minor Display Modes}, and @ref{Major
4e7428f6
EL
1149Display Modes}, you have control to @code{insert} anything you want.
1150
1151The conventions allow almost anything to be inserted, but several helper
1152functions are provided to make it easy to create the standardized
1153buttons.
1154
18fe4c71 1155To understand the built in functions, each `button' in speedbar consists
4e7428f6
EL
1156of four important pieces of data. The text to be displayed, token
1157data to be associated with the text, a function to call, and some face to
1158display it in.
1159
1160When a function is provided, then that text becomes mouse activated,
1161meaning the mouse will highlight the text.
1162
1163Additionally, for data which can form deep trees, each line is given a
1164depth which indicates how far down the tree it is. This information is
1165stored in invisible text at the beginning of each line, and is used by
1166the navigation commands.
1167
f29906f8 1168@defun speedbar-insert-button text face mouse function &optional token prevline
4e7428f6
EL
1169This function inserts one button into the current location.
1170@var{text} is the text to insert. @var{face} is the face in which it
1171will be displayed. @var{mouse} is the face to display over the text
1172when the mouse passes over it. @var{function} is called whenever the
1173user clicks on the text.
1174
1175The optional argument @var{token} is extra data to associated with the
49e6099b 1176text. Lastly @var{prevline} should be non-@code{nil} if you want this line to
4e7428f6
EL
1177appear directly after the last button which was created instead of on
1178the next line.
1179@end defun
1180
1181@defun speedbar-make-tag-line exp-button-type exp-button-char exp-button-function exp-button-data tag-button tag-button-function tag-button-data tag-button-face depth
1182
1183Create a tag line with @var{exp-button-type} for the small expansion
1184button. This is the button that expands or contracts a node (if
f29906f8 1185applicable), and @var{exp-button-char} the character in it (@samp{+},
45d5a9b3 1186@samp{-}, @samp{?}, etc). @var{exp-button-function} is the function
fb3ae391
RS
1187to call if it's clicked on. Button types are @code{bracket},
1188@code{angle}, @code{curly}, @code{expandtag}, @code{statictag}, and
45d5a9b3
JB
1189@code{nil}. @var{exp-button-data} is extra data attached to the text
1190forming the expansion button.
4e7428f6
EL
1191
1192Next, @var{tag-button} is the text of the tag.
1193@var{tag-button-function} is the function to call if clicked on, and
1194@var{tag-button-data} is the data to attach to the text field (such a
1195tag positioning, etc). @var{tag-button-face} is a face used for this
1196type of tag.
1197
1198Lastly, @var{depth} shows the depth of expansion.
1199
1200This function assumes that the cursor is in the speedbar window at the
5e59b0d9 1201position to insert a new item, and that the new item will end with a CR.
4e7428f6
EL
1202@end defun
1203
1204@defun speedbar-insert-generic-list level list expand-fun find-fun
1205
f29906f8 1206At @var{level}, (the current indentation level desired) insert a generic
4e7428f6
EL
1207multi-level alist @var{list}. Associations with lists get @samp{@{+@}}
1208tags (to expand into more nodes) and those with positions or other data
f29906f8 1209just get a @samp{>} as the indicator. @samp{@{+@}} buttons will have the
4e7428f6
EL
1210function @var{expand-fun} and the token is the @code{cdr} list. The
1211token name will have the function @var{find-fun} and not token.
1212
1213Each element of the list can have one of these forms:
f29906f8 1214
4e7428f6 1215@table @code
f29906f8
EZ
1216@item (@var{name} . marker-or-number)
1217One tag at this level.
1218@item (@var{name} (@var{name} . marker-or-number) (@var{name} . marker-or-number) ... )
1219One group of tags.
1220@item (@var{name} marker-or-number (@var{name} . marker-or-number) ... )
1221One Group of tags where the group has a starting position.
4e7428f6
EL
1222@end table
1223
1224When you use @code{speedbar-insert-generic-list}, there are some
1225variables you can set buffer-locally to change the behavior. The most
1226obvious is @code{speedbar-tag-hierarchy-method}.
1227@xref{Tag Hierarchy Methods}.
1228
1229@defvar speedbar-generic-list-group-expand-button-type
f29906f8 1230This is the button type used for groups of tags, whether expanded
4e7428f6 1231or added in via a hierarchy method. Two good values are
fb3ae391
RS
1232@code{curly} and @code{expandtag}. Curly is the default button, and
1233@code{expandtag} is useful if the groups also has a position.
4e7428f6
EL
1234@end defvar
1235
1236@defvar speedbar-generic-list-tag-button-type
1237This is the button type used for a single tag.
fb3ae391
RS
1238Two good values are @code{nil} and @code{statictag}.
1239@code{nil} is the default, and @code{statictag} has the same width as
1240@code{expandtag}.
4e7428f6
EL
1241@end defvar
1242
1243@end defun
1244
84247bb5
CY
1245@node GNU Free Documentation License, Index, Extending, Top
1246@appendix GNU Free Documentation License
1247@include doclicense.texi
1248
1249
1250@node Index, , GNU Free Documentation License, Top
4e7428f6
EL
1251@comment node-name, next, previous, up
1252@unnumbered Concept Index
1253@printindex cp
1254
4e7428f6 1255@bye
47d7776c 1256@c LocalWords: speedbar's xref slowbar kbd subsubsection
4e7428f6 1257@c LocalWords: keybindings
ab5796a9
MB
1258
1259@ignore
1260 arch-tag: e1fc85f0-1eeb-489f-a8d4-a2bfe711fa02
1261@end ignore