Next: , Previous: Major Display Modes, Up: Extending

7.3 Tagging Extensions

It is possible to create new methods for tagging files in speedbar. To do this, you need two basic functions, one function to fetch the tags from a buffer, the other to insert them below the filename.

— Function: my-fetch-dynamic-tags file

Parse file for a list of tags. Return the list, or t if there was an error.

The non-error return value can be anything, as long as it can be inserted by its paired function:

— Function: my-insert-tag-list level lst

Insert a list of tags lst started at indentation level level. Creates buttons for each tag, and provides any other display information required.

It is often useful to use speedbar-create-tag-hierarchy on your token list. See that function's documentation for details on what it requires.

Once these two functions are written, modify the variable speedbar-dynamic-tags-function-list to include your parser at the beginning, like this:

     (add-to-list 'speedbar-dynamic-tags-function-list
                  '(my-fetch-dynamic-tags . my-insert-tag-list))

If your parser is only good for a few types of files, make sure that it is either a buffer local modification, or that the tag generator returns t for non valid buffers.