1 \input texinfo @c -*-texinfo-*-
3 @setfilename ../info/speedbar
4 @settitle Speedbar: File/Tag summarizing utility
8 Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
9 2007 Free Software Foundation, Inc.
12 Permission is granted to copy, distribute and/or modify this document
13 under the terms of the GNU Free Documentation License, Version 1.2 or
14 any later version published by the Free Software Foundation; with the
15 Invariant Sections being ``The GNU Manifesto'', ``Distribution'' and
16 ``GNU GENERAL PUBLIC LICENSE'', with the Front-Cover texts being ``A GNU
17 Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
18 license is included in the section entitled ``GNU Free Documentation
19 License'' in the Emacs manual.
21 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
22 this GNU Manual, like GNU software. Copies published by the Free
23 Software Foundation raise funds for GNU development.''
25 This document is part of a collection distributed under the GNU Free
26 Documentation License. If you want to distribute this document
27 separately from the collection, you can do so by adding a copy of the
28 license to the document, as described in section 6 of the license.
34 * Speedbar: (speedbar). File/Tag summarizing utility.
39 @center @titlefont{Speedbar}
42 @vskip 0pt plus 1 fill
44 @vskip 0pt plus 1filll
48 @node Top, , , (dir)Top
49 @comment node-name, next, previous, up
51 Speedbar is a program for Emacs which can be used to summarize
52 information related to the current buffer. Its original inspiration
53 is the `explorer' often used in modern development environments, office
54 packages, and web browsers.
56 Speedbar displays a narrow frame in which a tree view is shown. This
57 tree view defaults to containing a list of files and directories. Files
58 can be `expanded' to list tags inside. Directories can be expanded to
59 list the files within itself. Each file or tag can be jumped to
62 Speedbar expands upon `explorer' windows by maintaining context with the
63 user. For example, when using the file view, the current buffer's file
64 is highlighted. Speedbar also mimics the explorer windows by providing
65 multiple display modes. These modes come in two flavors. Major display
66 modes remain consistent across buffers, and minor display modes appear
67 only when a buffer of the applicable type is shown. This allows
68 authors of other packages to provide speedbar summaries customized to
69 the needs of that mode.
71 Throughout this manual, activities are defined as `clicking on', or
72 `expanding' items. Clicking means using @kbd{Mouse-2} on a
73 button. Expanding refers to clicking on an expansion button to display
74 an expanded summary of the entry the expansion button is
75 on. @xref{Basic Navigation}.
78 * Introduction:: Basics of speedbar.
79 * Basic Navigation:: Basics of speedbar common between all modes.
80 * File Mode:: Summarizing files.
81 * Buffer Mode:: Summarizing buffers.
82 * Minor Modes:: Additional minor modes such as Info and RMAIL.
83 * Customizing:: Changing speedbar behavior.
84 * Extending:: Extend speedbar for your own project.
88 @node Introduction, Basic Navigation, , Top
89 @comment node-name, next, previous, up
93 To start using speedbar use the command @kbd{M-x speedbar RET} or
94 select it from the @samp{Options->Show/Hide} sub-menu. This command
95 will open a new frame to summarize the local files. On X Window
96 systems or on MS-Windows, speedbar's frame is twenty characters wide,
97 and will mimic the height of the frame from which it was started. It
98 positions itself to the left or right of the frame you started it
101 To use speedbar effectively, it is important to understand its
102 relationship with the frame you started it from. This frame is the
103 @dfn{attached frame} which speedbar will use as a reference point. Once
104 started, speedbar watches the contents of this frame, and attempts to
105 make its contents relevant to the buffer loaded into the attached
106 frame. In addition, all requests made in speedbar that require the
107 display of another buffer will display in the attached frame.
109 When used in terminal mode, the new frame appears the same size as the
110 terminal. Since it is not visible while working in the attached frame,
111 speedbar will save time by using the @dfn{slowbar mode}, where no tracking is
112 done until speedbar is requested to show itself (i.e., the speedbar's
113 frame becomes the selected frame).
115 @cindex @code{speedbar-get-focus}
116 The function to use when switching between frames using the keyboard is
117 @code{speedbar-get-focus}. This function will toggle between frames, and
118 it's useful to bind it to a key in terminal mode. @xref{Customizing}.
120 @node Basic Navigation, File Mode, Introduction, Top
121 @comment node-name, next, previous, up
122 @chapter Basic Navigation
124 Speedbar can display different types of data, and has several display
125 and behavior modes. These modes all have a common behavior, menu
126 system, and look. If one mode is learned, then the other modes are easy
130 * Basic Key Bindings::
136 @node Basic Key Bindings, Basic Visuals, Basic Navigation, Basic Navigation
137 @comment node-name, next, previous, up
138 @section Basic Key Bindings
141 These key bindings are common across all modes:
145 @cindex quitting speedbar
146 Quit speedbar, and kill the frame.
148 Quit speedbar, and hide the frame. This makes it faster to restore the
149 speedbar frame, than if you press @kbd{Q}.
151 @cindex refresh speedbar display
152 Refresh whatever contents are in speedbar.
155 Toggle speedbar to and from slowbar mode. In slowbar mode, frame
156 tracking is not done.
160 Move, respectively, to the next or previous item. A summary of that
161 item will be displayed in the attached frame's minibuffer.
164 Move to the next or previous item in a restricted fashion. If a list is
165 open, the cursor will skip over it. If the cursor is in an open list,
166 it will not leave it.
169 Move forwards and backwards across extended groups. This lets you
170 quickly skip over all files, directories, or other common sub-items at
171 the same current depth.
173 Switch buffers in the attached frame.
176 Speedbar can handle multiple modes. Two are provided by default.
177 These modes are File mode, and Buffers mode. There are accelerators to
178 switch into these different modes.
180 @cindex mode switching hotkeys
183 Switch into Quick Buffers mode (@pxref{Buffer Mode}). After one use, the
184 previous display mode is restored.
186 Switch into File mode.
188 Switch back to the previous mode.
191 Some modes provide groups, lists and tags. @xref{Basic Visuals}. When
192 these are available, some additional common bindings are available.
198 Edit/Open the current group or tag. This behavior is dependent on the
199 mode. In general, files or buffers are opened in the attached frame,
200 and directories or group nodes are expanded locally.
203 Expand the current group, displaying sub items.
204 When used with a prefix argument, any data that may have been cached is
205 flushed. This is similar to a power click. @xref{Mouse Bindings}.
207 Contract the current group, hiding sub items.
210 @node Basic Visuals, Mouse Bindings, Basic Key Bindings, Basic Navigation
211 @comment node-name, next, previous, up
212 @section Basic Visuals
215 Speedbar has visual cues for indicating different types of data. These
216 cues are used consistently across the different speedbar modes to make
217 them easier to interpret.
219 At a high level, in File mode, there are directory buttons, sub
220 directory buttons, file buttons, tag buttons, and expansion buttons.
221 This makes it easy to use the mouse to navigate a directory tree, and
222 quickly view files, or a summary of those files.
224 The most basic visual effect used to distinguish between these button
225 types is color and mouse highlighting. Anything the mouse highlights
226 can be clicked on and is called a button (@pxref{Mouse Bindings}).
227 Anything not highlighted by the mouse will not be clickable.
229 Text in speedbar consists of four different types of data. Knowing how
230 to read these textual elements will make it easier to navigate by
231 identifying the types of data available.
233 @subsubsection Groups
236 Groups summarize information in a single line, and provide a high level
237 view of more complex systems, like a directory tree, or manual chapters.
239 Groups appear at different indentation levels, and are prefixed with a
240 @samp{+} in some sort of `box'. The group name will summarize the
241 information within it, and the expansion box will display that
242 information inline. In File mode, directories and files are `groups'
243 where the @samp{+} is surrounded by brackets like this:
251 In this example, we see both open and closed directories, in addition to
252 a file. The directories have a box consisting of angle brackets, and a
253 file uses square brackets.
255 In all modes, a group can be `edited' by pressing @kbd{RET}, meaning a
256 file will be opened, or a directory explicitly opened in speedbar. A
257 group can be expanded or contracted using @kbd{+} or
258 @kbd{-}. @xref{Basic Key Bindings}.
260 Sometimes groups may have a @samp{?} in its indicator box. This means
261 that it is a group type, but there are no contents, or no known way of
262 extracting contents of that group.
264 When a group has been expanded, the indicator button changes from
265 @samp{+} to @samp{-}. This indicates that the contents are being shown.
266 Click the @samp{-} button to contract the group, or hide the contents
272 Tags are the leaf nodes of the tree system. Tags are generally prefixed
273 with a simple character, such as @samp{>}. Tags can only be jumped to using
274 @kbd{RET} or @kbd{e}.
276 @subsubsection Boolean Flags
278 Sometimes a group or tag is given a boolean flag. These flags appear as
279 extra text characters at the end of the line. File mode uses boolean
280 flags, such as a @samp{*} to indicate that a file has been checked out
281 of a versioning system.
283 For additional flags, see
284 @c Note to self, update these to sub-nodes which are more relevant.
285 @ref{File Mode}, and @ref{Version Control}.
287 @subsubsection Unadorned Text
289 Unadorned text generally starts in column 0, without any special symbols
290 prefixing them. In Buffers mode different buffer groups are prefixed
291 with a description of what the following buffers are (Files, scratch
292 buffers, and invisible buffers.)
294 Unadorned text will generally be colorless, and not clickable.
296 @subsubsection Color Cues
298 Each type of Group, item indicator, and label is given a different
299 color. The colors chosen are dependent on whether the background color
301 Of important note is that the `current item', which may be a buffer or
302 file name, is highlighted red, and underlined.
304 Colors can be customized from the group @code{speedbar-faces}. Some
305 modes, such as for Info, will use the Info colors instead of default
306 speedbar colors as an indication of what is currently being displayed.
308 The face naming convention mirrors the File display mode. Modes which
309 do not use files will attempt to use the same colors on analogous
312 @node Mouse Bindings, Displays Submenu, Basic Visuals, Basic Navigation
313 @comment node-name, next, previous, up
314 @section Mouse Bindings
315 @cindex mouse bindings
317 The mouse has become a common information navigation tool. Speedbar
318 will use the mouse to navigate file systems, buffer lists, and other
319 data. The different textual cues provide buttons which can be clicked
320 on (@pxref{Basic Visuals}). Anything that highlights can be clicked on
321 with the mouse, or affected by the menu.
323 The mouse bindings are:
327 Move cursor to that location.
329 @itemx Double-Mouse-1
330 Activate the current button. @kbd{Double-Mouse-1} is called a @dfn{double
331 click} on other platforms, and is useful for windows users with two
333 @c Isn't it true that with two-button mice, the right button is Mouse-2?
334 @c On GNU/Linux, the right button is Mouse-3.
336 @itemx S-Double-Mouse-1
338 This has the same effect as @kbd{Mouse-2}, except it is called a power
339 click. This means that if a group with an expansion button @samp{+} is
340 clicked, any caches are flushed, and subitems re-read. If it is a name,
341 it will be opened in a new frame.
343 Activate the speedbar menu. The item selected affects the line clicked,
344 not the line where the cursor was.
345 @item Mouse-1 @r{(mode line)}
346 Activate the menu. This affects the item the cursor is on before the
347 click, since the mouse was not clicked on anything.
349 Buffers sub-menu. The buffer in the attached frame is switched.
352 When the mouse moves over buttons in speedbar, details of that item
353 should be displayed in the minibuffer of the attached frame. Sometimes
354 this can contain extra information such as file permissions, or tag
357 @node Displays Submenu, , Mouse Bindings, Basic Navigation
358 @comment node-name, next, previous, up
359 @section Displays Submenu
360 @cindex displays submenu
362 You can display different data by using different display modes. These
363 specialized modes make it easier to navigate the relevant pieces of
364 information, such as files and directories, or buffers.
366 In the main menu, found by clicking @kbd{Mouse-3}, there is a submenu
367 labeled @samp{Displays}. This submenu lets you easily choose between
368 different display modes.
370 The contents are modes currently loaded into emacs. By default, this
371 would include Files, Quick Buffers, and Buffers. Other major display
372 modes such as Info are loaded separately.
374 @node File Mode, Buffer Mode, Basic Navigation, Top
375 @comment node-name, next, previous, up
379 File mode displays a summary of your current directory. You can display
380 files in the attached frame, or summarize the tags found in files. You
381 can even see if a file is checked out of a version control system, or
382 has some associated object file.
384 Advanced behavior, like copying and renaming files, is also provided.
387 * Directory Display:: What the display means.
388 * Hidden Files:: How to display hidden files.
389 * File Key Bindings:: Performing file operations.
392 @node Directory Display, Hidden Files, File Mode, File Mode
393 @comment node-name, next, previous, up
394 @section Directory Display
395 @cindex directory display
397 There are three major sections in the display. The first line or two is
398 the root directory speedbar is currently viewing. You can jump to one
399 of the parent directories by clicking on the name of the directory you
402 Next, directories are listed. A directory starts with the group
403 indicator button @samp{<+>}. Clicking the directory name makes speedbar
404 load that directory as the root directory for its display. Clicking the
405 @samp{<+>} button will list all directories and files beneath.
407 Next, files are listed. Files start with the group indicator @samp{[+]}
408 or @samp{[?]}. You can jump to a file in the attached frame by clicking
409 on the file name. You can expand a file and look at its tags by
410 clicking on the @samp{[+]} symbol near the file name.
412 A typical session might look like this:
436 In this example, you can see several directories. The directory
437 @file{speedbar} has been opened inline. Inside the directory
438 @file{speedbar}, the file @file{speedbar.el} has its tags exposed.
439 These tags are extensive, and they are summarized into tag groups.
441 Files get additional boolean flags associated with them. Valid flags are:
446 This file has been checked out of a version control
447 system. @xref{Version Control}.
448 @cindex @code{speedbar-obj-alist}
450 This file has an up to date object file associated with it. The
451 variable @code{speedbar-obj-alist} defines how speedbar determines this
454 This file has an out of date object file associated with it.
457 A Tag group is prefixed with the symbol @samp{@{+@}}. Clicking this
458 symbol will show all symbols that have been organized into that group.
459 Different types of files have unique tagging methods as defined by their
460 major mode. Tags are generated with either the @code{imenu} package, or
461 through the @code{etags} interface.
463 Tag groups are defined in multiple ways which make it easier to find the
464 tag you are looking for. Imenu keywords explicitly create groups, and
465 speedbar will automatically create groups if tag lists are too long.
467 In our example, Imenu created the groups @samp{Types} and
468 @samp{Variables}. All remaining top-level symbols are then regrouped
469 based on the variable @code{speedbar-tag-hierarchy-method}. The
470 subgroups @samp{def} and @samp{speedbar-} are groupings where the first
471 few characters of the given symbols are specified in the group name.
472 Some group names may say something like @samp{speedbar-t to speedbar-v},
473 indicating that all symbols which alphabetically fall between those
474 categories are included in that sub-group. @xref{Tag Hierarchy Methods}.
476 @node Hidden Files, File Key Bindings, Directory Display, File Mode
477 @comment node-name, next, previous, up
478 @section Hidden Files
481 On GNU and Unix systems, a hidden file is a file whose name starts
482 with a period. They are hidden from a regular directory listing
483 because the user is not generally interested in them.
485 In speedbar, a hidden file is a file which isn't very interesting and
486 might prove distracting to the user. Any uninteresting files are
487 removed from the File display. There are two levels of uninterest in
488 speedbar. The first level of uninterest are files which have no
489 expansion method, or way of extracting tags. The second level is any
490 file that matches the same pattern used for completion in
491 @code{find-file}. This is derived from the variable
492 @code{completion-ignored-extensions}.
494 You can toggle the display of uninteresting files from the toggle menu
495 item @samp{Show All Files}. This will display all level one hidden files.
496 These files will be shown with a @samp{?} indicator. Level 2 hidden
497 files will still not be shown.
499 Object files fall into the category of level 2 hidden files. You can
500 determine their presence by the @samp{#} and @samp{!} file indicators.
501 @xref{Directory Display}.
503 @node File Key Bindings, , Hidden Files, File Mode
504 @comment node-name, next, previous, up
505 @section File Key Bindings
506 @cindex file key bindings
508 File mode has key bindings permitting different file system operations
509 such as copy or rename. These commands all operate on the @dfn{current
510 file}. In this case, the current file is the file at point, or clicked
511 on when pulling up the menu.
515 Move the entire speedbar display up one directory.
517 Display information in the minibuffer about this line. This is the same
518 information shown when navigating with @kbd{n} and @kbd{p}, or moving
519 the mouse over an item.
521 Byte compile the Emacs Lisp file on this line.
523 Load the Emacs Lisp file on this line. If a @file{.elc} file exists,
524 optionally load that.
526 Copy the current file to some other location.
528 Rename the current file, possibly moving it to some other location.
530 Delete the current file.
532 Delete the current file's object file. Use the symbols @samp{#} and
533 @samp{!} to determine if there is an object file available.
536 One menu item toggles the display of all available files. By default,
537 only files which Emacs understands, and knows how to convert into a tag
538 list, are shown. By showing all files, additional files such as text files are
539 also displayed, but they are prefixed with the @samp{[?]} symbol. This
540 means that it is a file, but Emacs doesn't know how to expand it.
542 @node Buffer Mode, Minor Modes, File Mode, Top
543 @comment node-name, next, previous, up
547 Buffer mode is very similar to File mode, except that instead of
548 tracking the current directory and all files available there, the
549 current list of Emacs buffers is shown.
551 These buffers can have their tags expanded in the same way as files,
552 and uses the same unknown file indicator (@pxref{File Mode}).
554 Buffer mode does not have file operation bindings, but the following
555 buffer specific key bindings are available:
559 Kill this buffer. Do not touch its file.
561 Revert this buffer, reloading from disk.
564 In addition to Buffer mode, there is also Quick Buffer mode. In fact,
565 Quick Buffers is bound to the @kbd{b} key. The only difference between
566 Buffers and Quick Buffers is that after one operation is performed
567 which affects the attached frame, the display is immediately reverted to
568 the last displayed mode.
570 Thus, if you are in File mode, and you need quick access to a buffer,
571 press @kbd{b}, click on the buffer you want, and speedbar will revert
574 @node Minor Modes, Customizing, Buffer Mode, Top
575 @comment node-name, next, previous, up
576 @chapter Minor Display Modes
577 @cindex minor display modes
579 For some buffers, a list of files and tags makes no sense. This could
580 be because files are not currently in reference (such as web pages), or
581 that the files you might be interested have special properties (such as
584 In these cases, a minor display mode is needed. A minor display mode
585 will override any major display mode currently being displayed for the
586 duration of the specialized buffer's use. Minor display modes
587 will follow the general rules of their major counterparts in terms of
588 key bindings and visuals, but will have specialized behaviors.
591 * RMAIL:: Managing folders.
592 * Info:: Browsing topics.
593 * GDB:: Watching expressions or managing the current
597 @node RMAIL, Info, Minor Modes, Minor Modes
598 @comment node-name, next, previous, up
602 When using RMAIL, speedbar will display two sections. The first is a
603 layer one reply button. Clicking here will initialize a reply buffer
604 showing only this email address in the @samp{To:} field.
606 The second section lists all RMAIL folders in the same directory as your
607 main RMAIL folder. The general rule is that RMAIL folders always appear
608 in all caps, or numbers. It is possible to save mail in folders with
609 lower case letters, but there is no clean way of detecting such RMAIL folders
610 without opening them all.
612 Each folder can be visited by clicking the name. You can move mail from
613 the current RMAIL folder into a different folder by clicking the
614 @samp{<M>} button. The @samp{M} stands for Move.
616 In this way you can manage your existing RMAIL folders fairly easily
619 @node Info, GDB, RMAIL, Minor Modes
620 @comment node-name, next, previous, up
624 When browsing Info files, all local relevant information is displayed in
625 the info buffer and a topical high-level view is provided in speedbar.
626 All top-level info nodes are shown in the speedbar frame, and can be
627 jumped to by clicking the name.
629 You can open these nodes with the @samp{[+]} button to see what sub-topics
630 are available. Since these sub-topics are not examined until you click
631 the @samp{[+]} button, sometimes a @samp{[?]} will appear when you click on
632 a @samp{[+]}, indicating that there are no sub-topics.
634 @node GDB, , Info, Minor Modes
635 @comment node-name, next, previous, up
640 You can debug an application with GDB in Emacs using graphical mode or
641 text command mode (@pxref{GDB Graphical Interface,,, emacs, The
642 extensible self-documenting text editor}).
644 If you are using graphical mode you can see how selected variables
645 change each time your program stops (@pxref{Watch Expressions,,,
646 emacs, The extensible self-documenting text editor}).
648 If you are using text command mode, speedbar can show
649 you the current stack when the current buffer is the @file{*gdb*}
650 buffer. Usually, it will just report that there is no stack, but when
651 the application is stopped, the current stack will be shown.
653 You can click on any stack element and gdb will move to that stack
654 level. You can then check variables local to that level at the GDB
657 @node Customizing, Extending, Minor Modes, Top
658 @comment node-name, next, previous, up
662 Speedbar is highly customizable, with a plethora of control elements.
663 Since speedbar is so visual and reduces so much information, this is an
664 important aspect of its behavior.
666 In general, there are three custom groups you can use to quickly modify
671 Basic speedbar behaviors.
673 Customizations regarding version control handling.
675 Customize speedbar's many colors and fonts.
679 * Frames and Faces:: Visible behaviors.
680 * Tag Hierarchy Methods:: Customizing how tags are displayed.
681 * Version Control:: Adding new VC detection modes.
682 * Hooks:: The many hooks you can use.
685 @node Frames and Faces, Tag Hierarchy Methods, Customizing, Customizing
686 @comment node-name, next, previous, up
687 @section Frames and Faces
689 @cindex frame parameters
691 There are several faces speedbar generates to provide a consistent
692 color scheme across display types. You can customize these faces using
693 your favorite method. They are:
696 @cindex @code{speedbar-button-face}
697 @item speedbar-button-face
698 Face used on expand/contract buttons.
699 @cindex @code{speedbar-file-face}
700 @item speedbar-file-face
701 Face used on Files. Should also be used on non-directory like nodes.
702 @cindex @code{speedbar-directory-face}
703 @item speedbar-directory-face
704 Face used for directories, or nodes which consist of groups of other nodes.
705 @cindex @code{speedbar-tag-face}
706 @item speedbar-tag-face
707 Face used for tags in a file, or for leaf items.
708 @cindex @code{speedbar-selected-face}
709 @item speedbar-selected-face
710 Face used to highlight the selected item. This would be the current
712 @cindex @code{speedbar-highlight-face}
713 @item speedbar-highlight-face
714 Face used when the mouse passes over a button.
717 You can also customize speedbar's initial frame parameters. How this is
718 accomplished is dependent on your platform being Emacs or XEmacs.
720 @cindex @code{speedbar-frame-parameters}, Emacs
721 In Emacs, change the alist @code{speedbar-frame-parameters}. This
722 variable is used to set up initial details. Height is also
723 automatically added when speedbar is created, though you can override
726 @cindex @code{speedbar-frame-plist}, XEmacs
727 In XEmacs, change the plist @code{speedbar-frame-plist}. This is the
728 XEmacs way of doing the same thing.
730 @node Tag Hierarchy Methods, Version Control, Frames and Faces, Customizing
731 @comment node-name, next, previous, up
732 @section Tag Hierarchy Methods
733 @cindex tag hierarchy
737 When listing tags within a file, it is possible to get an annoyingly
738 long list of entries. Imenu (which generates the tag list in Emacs)
739 will group some classes of items automatically. Even here, however,
740 some tag groups can be quite large.
742 @cindex @code{speedbar-tag-hierarchy-method}
743 To solve this problem, tags can be grouped into logical units through a
744 hierarchy processor. The specific variable to use is
745 @code{speedbar-tag-hierarchy-method}. There are several methods that
746 can be applied in any order. They are:
749 @cindex @code{speedbar-trim-words-tag-hierarchy}
750 @item speedbar-trim-words-tag-hierarchy
751 Find a common prefix for all elements of a group, and trim it off.
752 @cindex @code{speedbar-prefix-group-tag-hierarchy}
753 @item speedbar-prefix-group-tag-hierarchy
754 If a group is too large, place sets of tags into bins based on common
756 @cindex @code{speedbar-simple-group-tag-hierarchy}
757 @item speedbar-simple-group-tag-hierarchy
758 Take all items in the top level list not in a group, and stick them into
760 @cindex @code{speedbar-sort-tag-hierarchy}
761 @item speedbar-sort-tag-hierarchy
762 Sort all items, leaving groups on top.
765 You can also add your own functions to reorganize tags as you see fit.
767 Some other control variables are:
770 @cindex @code{speedbar-tag-group-name-minimum-length}
771 @item speedbar-tag-group-name-minimum-length
774 The minimum length of a prefix group name before expanding. Thus, if
775 the @code{speedbar-tag-hierarchy-method} includes
776 @code{speedbar-prefix-group-tag-hierarchy} and one such group's common
777 characters is less than this number of characters, then the group name
778 will be changed to the form of:
790 This way we won't get silly looking listings.
792 @cindex @code{speedbar-tag-split-minimum-length}
793 @item speedbar-tag-split-minimum-length
796 Minimum length before we stop trying to create sub-lists in tags.
797 This is used by all tag-hierarchy methods that break large lists into
800 @cindex @code{speedbar-tag-regroup-maximum-length}
801 @item speedbar-tag-regroup-maximum-length
804 Maximum length of submenus that are regrouped.
805 If the regrouping option is used, then if two or more short subgroups
806 are next to each other, then they are combined until this number of
810 @node Version Control, Hooks, Tag Hierarchy Methods, Customizing
811 @comment node-name, next, previous, up
812 @section Version Control
813 @cindex version control
814 @cindex vc extensions
816 When using the file mode in speedbar, information regarding a version
817 control system adds small details to the display. If a file is in a
818 version control system, and is ``checked out'' or ``locked'' locally, an
819 asterisk @samp{*} appears at the end of the file name. In addition,
820 the directory name for Version Control systems are left out of the
823 @cindex @code{speedbar-directory-unshown-regexp}
824 You can easily add new version control systems into speedbar's detection
825 scheme. To make a directory ``disappear'' from the list, use the variable
826 @code{speedbar-directory-unshown-regexp}.
828 @cindex @code{speedbar-vc-path-enable-hook}
829 Next, you need to write entries for two hooks. The first is
830 @code{speedbar-vc-path-enable-hook} which will enable a VC check in the
831 current directory for the group of files being checked. Your hook
832 function should take one parameter (the directory to check) and return
833 @code{t} if your VC method is in control here.
835 @cindex @code{speedbar-vc-in-control-hook}
836 The second function is @code{speedbar-vc-in-control-hook}. This hook
837 takes two parameters, the @var{path} of the file to check, and the
838 @var{file} name. Return @code{t} if you want to have the asterisk
839 placed near this file.
841 @cindex @code{speedbar-vc-indicator}
842 Lastly, you can change the VC indicator using the variable
843 @code{speedbar-vc-indicator}, and specify a single character string.
845 @node Hooks, , Version Control, Customizing
846 @comment node-name, next, previous, up
850 There are several hooks in speedbar allowing custom behaviors to be
851 added. Available hooks are:
854 @cindex @code{speedbar-visiting-file-hook}
855 @item speedbar-visiting-file-hook
856 Hooks run when speedbar visits a file in the selected frame.
857 @cindex @code{speedbar-visiting-tag-hook}
858 @item speedbar-visiting-tag-hook
859 Hooks run when speedbar visits a tag in the selected frame.
860 @cindex @code{speedbar-load-hook}
861 @item speedbar-load-hook
862 Hooks run when speedbar is loaded.
863 @cindex @code{speedbar-reconfigure-keymaps-hook}
864 @item speedbar-reconfigure-keymaps-hook
865 Hooks run when the keymaps are regenerated. Keymaps are reconfigured
866 whenever modes change. This will let you add custom key bindings.
867 @cindex @code{speedbar-before-popup-hook}
868 @item speedbar-before-popup-hook
869 Hooks called before popping up the speedbar frame.
870 New frames are often popped up when ``power clicking'' on an item to view
872 @cindex @code{speedbar-before-delete-hook}
873 @item speedbar-before-delete-hook
874 Hooks called before deleting or hiding the speedbar frame.
875 @cindex @code{speedbar-mode-hook}
876 @item speedbar-mode-hook
877 Hooks called after creating a speedbar buffer.
878 @cindex @code{speedbar-timer-hook}
879 @item speedbar-timer-hook
880 Hooks called after running the speedbar timer function.
881 @cindex @code{speedbar-scanner-reset-hook}
882 @item speedbar-scanner-reset-hook
883 Hook called whenever generic scanners are reset.
884 Set this to implement your own scanning or rescan safe functions with
888 @node Extending, Index, Customizing, Top
889 @comment node-name, next, previous, up
893 Speedbar can run different types of Major display modes such as Files
894 (@pxref{File Mode}), and Buffers (@pxref{Buffer Mode}). It can also manage
895 different minor display modes for use with buffers handling specialized
898 These major and minor display modes are handled through an extension
899 system which permits specialized keymaps and menu extensions, in
900 addition to a unique rendering function. You can also specify a wide
901 range of tagging functions. The default uses @code{imenu}, but new
902 tagging methods can be easily added. In this chapter, you will
903 learn how to write your own major or minor display modes, and how to
904 create specialized tagging functions.
907 * Minor Display Modes:: How to create a minor display mode.
908 * Major Display Modes:: How to create a major display mode.
909 * Tagging Extensions:: How to create your own tagging methods.
910 * Creating a display:: How to insert buttons and hierarchies.
913 @node Minor Display Modes, Major Display Modes, Extending, Extending
914 @section Minor Display Modes
915 @cindex create minor display mode
917 A @dfn{minor display mode} is a mode useful when using a specific type of
918 buffer. This mode might not be useful for any other kind of data or
919 mode, or may just be more useful that a files or buffers based mode when
920 working with a specialized mode.
922 Examples that already exist for speedbar include RMAIL, Info, and gdb.
923 These modes display information specific to the major mode shown in the
926 To enable a minor display mode in your favorite Major mode, follow these
927 steps. The string @samp{@var{name}} is the name of the major mode being
928 augmented with speedbar.
932 Create the keymap variable @code{@var{name}-speedbar-key-map}.
935 Create a function, named whatever you like, which assigns values into your
936 keymap. Use this command to create the keymap before assigning
940 (setq @var{name}-speedbar-key-map (speedbar-make-specialized-keymap))
943 This function creates a special keymap for use in speedbar.
946 Call your install function, or assign it to a hook like this:
949 (if (featurep 'speedbar)
950 (@var{name}-install-speedbar-variables)
951 (add-hook 'speedbar-load-hook '@var{name}-install-speedbar-variables))
955 Create an easymenu compatible vector named
956 @code{@var{name}-speedbar-menu-items}. This will be spliced into
957 speedbar's control menu.
960 Create a function called @code{@var{name}-speedbar-buttons}. This function
961 should take one variable, which is the buffer for which it will create
962 buttons. At this time @code{(current-buffer)} will point to the
963 uncleared speedbar buffer.
966 When writing @code{@var{name}-speedbar-buttons}, the first thing you will
967 want to do is execute a check to see if you need to re-create your
968 display. If it needs to be cleared, you need to erase the speedbar
969 buffer yourself, and start drawing buttons. @xref{Creating a display}.
971 @node Major Display Modes, Tagging Extensions, Minor Display Modes, Extending
972 @section Major Display Modes
973 @cindex create major display mode
975 Creating a @dfn{Major Display Mode} for speedbar requires authoring a keymap,
976 an easy-menu segment, and writing several functions. These items can be
977 given any name, and are made the same way as in a minor display mode
978 (@pxref{Minor Display Modes}). Once this is done, these items need to be
981 Because this setup activity may or may not have speedbar available when
982 it is being loaded, it is necessary to create an install function. This
983 function should create and initialize the keymap, and add your
984 expansions into the customization tables.
986 @cindex @code{speedbar-make-specialized-keymap}
987 When creating the keymap, use the function
988 @code{speedbar-make-specialized-keymap} instead of other keymap making
989 functions. This will provide you with the initial bindings needed.
990 Some common speedbar functions you might want to bind are:
993 @cindex @code{speedbar-edit-line}
994 @item speedbar-edit-line
995 Edit the item on the current line.
996 @cindex @code{speedbar-expand-line}
997 @item speedbar-expand-line
998 Expand the item under the cursor.
999 With a numeric argument (@kbd{C-u}), flush cached data before expanding.
1000 @cindex @code{speedbar-contract-line}
1001 @item speedbar-contract-line
1002 Contract the item under the cursor.
1005 @cindex @code{speedbar-line-path}
1006 These function require that function @code{speedbar-line-path} be
1007 correctly overloaded to work.
1009 Next, register your extension like this;
1012 (speedbar-add-expansion-list '("MyExtension"
1013 MyExtension-speedbar-menu-items
1014 MyExtension-speedbar-key-map
1015 MyExtension-speedbar-buttons))
1018 There are no limitations to the names you use.
1020 The first parameter is the string representing your display mode.
1021 The second parameter is a variable name containing an easymenu compatible
1022 menu definition. This will be stuck in the middle of speedbar's menu.
1023 The third parameter is the variable name containing the keymap we
1025 The last parameter is a function which draws buttons for your mode.
1026 This function must take two parameters. The directory currently being
1027 displayed, and the depth at which you should start rendering buttons.
1028 The function will then draw (starting at the current cursor position)
1029 any buttons deemed necessary based on the input parameters.
1030 @xref{Creating a display}.
1032 Next, you need to register function overrides. This may look something
1036 (speedbar-add-mode-functions-list
1038 (speedbar-item-info . MyExtension-speedbar-item-info)
1039 (speedbar-line-path . MyExtension-speedbar-line-path)))
1042 The first element in the list is the name of you extension. The second
1043 is an alist of functions to overload. The function to overload is
1044 first, followed by what you want called instead.
1046 For @code{speedbar-line-path} your function should take an optional DEPTH
1047 parameter. This is the starting depth for heavily indented lines. If
1048 it is not provided, you can derive it like this:
1055 (looking-at "^\\([0-9]+\\):")
1056 (setq depth (string-to-int (match-string 1)))))
1060 where the depth is stored as invisible text at the beginning of each
1063 The path returned should be the full path name of the file associated
1064 with that line. If the cursor is on a tag, then the file containing
1065 that tag should be returned. This is critical for built in file based
1066 functions to work (meaning less code for you to write). If your display
1067 does not deal in files, you do not need to overload this function.
1069 @cindex @code{speedbar-item-info}
1070 The function @code{speedbar-item-info}, however, is very likely to need
1071 overloading. This function takes no parameters and must derive a text
1072 summary to display in the minibuffer.
1074 There are several helper functions you can use if you are going to use
1075 built in tagging. These functions can be @code{or}ed since each one
1076 returns non-@code{nil} if it displays a message. They are:
1079 @cindex @code{speedbar-item-info-file-helper}
1080 @item speedbar-item-info-file-helper
1081 This takes an optional @var{filename} parameter. You can derive your own
1082 filename, or it will derive it using a (possibly overloaded) function
1083 @code{speedbar-line-file}. It shows details about a file.
1084 @cindex @code{speedbar-item-info-tag-helper}
1085 @item speedbar-item-info-tag-helper
1086 If the current line is a tag, then display information about that tag,
1087 such as its parent file, and location.
1090 Your custom function might look like this:
1093 (defun MyExtension-item-info ()
1094 "Display information about the current line."
1095 (or (speedbar-item-info-tag-helper)
1096 (message "Interesting detail.")))
1099 Once you have done all this, speedbar will show an entry in the
1100 @samp{Displays} menu declaring that your extension is available.
1102 @node Tagging Extensions, Creating a display, Major Display Modes, Extending
1103 @section Tagging Extensions
1105 It is possible to create new methods for tagging files in speedbar.
1106 To do this, you need two basic functions, one function to fetch the
1107 tags from a buffer, the other to insert them below the filename.
1109 @defun my-fetch-dynamic-tags file
1110 Parse @var{file} for a list of tags. Return the list, or @code{t} if there was
1114 The non-error return value can be anything, as long as it can be
1115 inserted by its paired function:
1117 @defun my-insert-tag-list level lst
1118 Insert a list of tags @var{lst} started at indentation level
1119 @var{level}. Creates buttons for each tag, and provides any other
1120 display information required.
1123 @cindex @code{speedbar-create-tag-hierarchy}
1124 It is often useful to use @code{speedbar-create-tag-hierarchy} on your
1125 token list. See that function's documentation for details on what it
1128 @cindex @code{speedbar-dynamic-tags-function-list}
1129 Once these two functions are written, modify the variable
1130 @code{speedbar-dynamic-tags-function-list} to include your parser at the
1131 beginning, like this:
1134 (add-to-list 'speedbar-dynamic-tags-function-list
1135 '(my-fetch-dynamic-tags . my-insert-tag-list))
1138 If your parser is only good for a few types of files, make sure that it
1139 is either a buffer local modification, or that the tag generator returns
1140 @code{t} for non valid buffers.
1142 @node Creating a display, , Tagging Extensions, Extending
1143 @section Creating a display
1144 @cindex creating a display
1146 Rendering a display in speedbar is completely flexible. When your
1147 button function is called, see @ref{Minor Display Modes}, and @ref{Major
1148 Display Modes}, you have control to @code{insert} anything you want.
1150 The conventions allow almost anything to be inserted, but several helper
1151 functions are provided to make it easy to create the standardized
1154 To understand the built in functions, each `button' in speedbar consists
1155 of four important pieces of data. The text to be displayed, token
1156 data to be associated with the text, a function to call, and some face to
1159 When a function is provided, then that text becomes mouse activated,
1160 meaning the mouse will highlight the text.
1162 Additionally, for data which can form deep trees, each line is given a
1163 depth which indicates how far down the tree it is. This information is
1164 stored in invisible text at the beginning of each line, and is used by
1165 the navigation commands.
1167 @defun speedbar-insert-button text face mouse function &optional token prevline
1168 This function inserts one button into the current location.
1169 @var{text} is the text to insert. @var{face} is the face in which it
1170 will be displayed. @var{mouse} is the face to display over the text
1171 when the mouse passes over it. @var{function} is called whenever the
1172 user clicks on the text.
1174 The optional argument @var{token} is extra data to associated with the
1175 text. Lastly @var{prevline} should be non-@code{nil} if you want this line to
1176 appear directly after the last button which was created instead of on
1180 @defun speedbar-make-tag-line exp-button-type exp-button-char exp-button-function exp-button-data tag-button tag-button-function tag-button-data tag-button-face depth
1182 Create a tag line with @var{exp-button-type} for the small expansion
1183 button. This is the button that expands or contracts a node (if
1184 applicable), and @var{exp-button-char} the character in it (@samp{+},
1185 @samp{-}, @samp{?}, etc). @var{exp-button-function} is the function
1186 to call if it's clicked on. Button types are @code{bracket},
1187 @code{angle}, @code{curly}, @code{expandtag}, @code{statictag}, and
1188 @code{nil}. @var{exp-button-data} is extra data attached to the text
1189 forming the expansion button.
1191 Next, @var{tag-button} is the text of the tag.
1192 @var{tag-button-function} is the function to call if clicked on, and
1193 @var{tag-button-data} is the data to attach to the text field (such a
1194 tag positioning, etc). @var{tag-button-face} is a face used for this
1197 Lastly, @var{depth} shows the depth of expansion.
1199 This function assumes that the cursor is in the speedbar window at the
1200 position to insert a new item, and that the new item will end with a CR.
1203 @defun speedbar-insert-generic-list level list expand-fun find-fun
1205 At @var{level}, (the current indentation level desired) insert a generic
1206 multi-level alist @var{list}. Associations with lists get @samp{@{+@}}
1207 tags (to expand into more nodes) and those with positions or other data
1208 just get a @samp{>} as the indicator. @samp{@{+@}} buttons will have the
1209 function @var{expand-fun} and the token is the @code{cdr} list. The
1210 token name will have the function @var{find-fun} and not token.
1212 Each element of the list can have one of these forms:
1215 @item (@var{name} . marker-or-number)
1216 One tag at this level.
1217 @item (@var{name} (@var{name} . marker-or-number) (@var{name} . marker-or-number) ... )
1219 @item (@var{name} marker-or-number (@var{name} . marker-or-number) ... )
1220 One Group of tags where the group has a starting position.
1223 When you use @code{speedbar-insert-generic-list}, there are some
1224 variables you can set buffer-locally to change the behavior. The most
1225 obvious is @code{speedbar-tag-hierarchy-method}.
1226 @xref{Tag Hierarchy Methods}.
1228 @defvar speedbar-generic-list-group-expand-button-type
1229 This is the button type used for groups of tags, whether expanded
1230 or added in via a hierarchy method. Two good values are
1231 @code{curly} and @code{expandtag}. Curly is the default button, and
1232 @code{expandtag} is useful if the groups also has a position.
1235 @defvar speedbar-generic-list-tag-button-type
1236 This is the button type used for a single tag.
1237 Two good values are @code{nil} and @code{statictag}.
1238 @code{nil} is the default, and @code{statictag} has the same width as
1244 @node Index, , Extending, Top
1245 @comment node-name, next, previous, up
1246 @unnumbered Concept Index
1250 @c LocalWords: speedbar's xref slowbar kbd subsubsection
1251 @c LocalWords: keybindings
1254 arch-tag: e1fc85f0-1eeb-489f-a8d4-a2bfe711fa02