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:

speedbar-trim-words-tag-hierarchy

Find a common prefix for all elements of a group, and trim it off.

speedbar-prefix-group-tag-hierarchy

If a group is too large, place sets of tags into bins based on common prefixes.

speedbar-simple-group-tag-hierarchy

Take all items in the top level list not in a group, and stick them into a ‘Tags’ group.

speedbar-sort-tag-hierarchy

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:

speedbar-tag-group-name-minimum-length

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

word

This way we won’t get silly looking listings.

speedbar-tag-split-minimum-length

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.

speedbar-tag-regroup-maximum-length

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.