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