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