[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6. Customizing

Speedbar is highly customizable, with a plethora of control elements. Since speedbar is so visual and reduces so much information, this is an important aspect of its behavior.

In general, there are three custom groups you can use to quickly modify speedbar's behavior.

Basic speedbar behaviors.
Customizations regarding version control handling.
Customize speedbar's many colors and fonts.

6.1 Frames and Faces  Visible behaviors.
6.2 Tag Hierarchy Methods  Customizing how tags are displayed.
6.3 Version Control  Adding new VC detection modes.
6.4 Hooks  The many hooks you can use.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.1 Frames and Faces

There are several faces speedbar generates to provide a consistent color scheme across display types. You can customize these faces using your favorite method. They are:

Face used on expand/contract buttons.
Face used on Files. Should also be used on non-directory like nodes.
Face used for directories, or nodes which consist of groups of other nodes.
Face used for tags in a file, or for leaf items.
Face used to highlight the selected item. This would be the current file being edited.
Face used when the mouse passes over a button.

You can also customize speedbar's initial frame parameters. How this is accomplished is dependent on your platform being Emacs or XEmacs.

In Emacs, change the alist speedbar-frame-parameters. This variable is used to set up initial details. Height is also automatically added when speedbar is created, though you can override it.

In XEmacs, change the plist speedbar-frame-plist. This is the XEmacs way of doing the same thing.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.2 Tag Hierarchy Methods

When listing tags within a file, it is possible to get an annoyingly long list of entries. Imenu (which generates the tag list in Emacs) will group some classes of items automatically. Even here, however, some tag groups can be quite large.

To solve this problem, tags can be grouped into logical units through a hierarchy processor. The specific variable to use is speedbar-tag-hierarchy-method. There are several methods that can be applied in any order. They are:

Find a common prefix for all elements of a group, and trim it off.
If a group is too large, place sets of tags into bins based on common prefixes.
Take all items in the top level list not in a group, and stick them into a `Tags' group.
Sort all items, leaving groups on top.

You can also add your own functions to reorganize tags as you see fit.

Some other control variables are:

Default value: 4.

The minimum length of a prefix group name before expanding. Thus, if the speedbar-tag-hierarchy-method includes speedbar-prefix-group-tag-hierarchy and one such group's common characters is less than this number of characters, then the group name will be changed to the form of:

worda to wordb

instead of just


This way we won't get silly looking listings.

Default value: 20.

Minimum length before we stop trying to create sub-lists in tags. This is used by all tag-hierarchy methods that break large lists into sub-lists.

Default value: 10.

Maximum length of submenus that are regrouped. If the regrouping option is used, then if two or more short subgroups are next to each other, then they are combined until this number of items is reached.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.3 Version Control

When using the file mode in speedbar, information regarding a version control system adds small details to the display. If a file is in a version control system, and is "checked out" or "locked" locally, an asterisk `*' appears at the end of the file name. In addition, the directory name for Version Control systems are left out of the speedbar display.

You can easily add new version control systems into speedbar's detection scheme. To make a directory "disappear" from the list, use the variable speedbar-directory-unshown-regexp.

Next, you need to write entries for two hooks. The first is speedbar-vc-path-enable-hook which will enable a VC check in the current directory for the group of files being checked. Your hook function should take one parameter (the directory to check) and return t if your VC method is in control here.

The second function is speedbar-vc-in-control-hook. This hook takes two parameters, the path of the file to check, and the file name. Return t if you want to have the asterisk placed near this file.

Lastly, you can change the VC indicator using the variable speedbar-vc-indicator, and specify a single character string.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.4 Hooks

There are several hooks in speedbar allowing custom behaviors to be added. Available hooks are:

Hooks run when speedbar visits a file in the selected frame.
Hooks run when speedbar visits a tag in the selected frame.
Hooks run when speedbar is loaded.
Hooks run when the keymaps are regenerated. Keymaps are reconfigured whenever modes change. This will let you add custom key bindings.
Hooks called before popping up the speedbar frame. New frames are often popped up when "power clicking" on an item to view it.
Hooks called before deleting or hiding the speedbar frame.
Hooks called after creating a speedbar buffer.
Hooks called after running the speedbar timer function.
Hook called whenever generic scanners are reset. Set this to implement your own scanning or rescan safe functions with state data.

[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by XEmacs Webmaster on October, 2 2007 using texi2html