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