speedbar: Minor Display Modes
7.1 Minor Display Modes
=======================
A “minor display mode” is a mode useful when using a specific type of
buffer. This mode might not be useful for any other kind of data or
mode, or may just be more useful that a files or buffers based mode when
working with a specialized mode.
Examples that already exist for speedbar include RMAIL, Info, and
gdb. These modes display information specific to the major mode shown
in the attached frame.
To enable a minor display mode in your favorite Major mode, follow
these steps. The string ‘NAME’ is the name of the major mode being
augmented with speedbar.
1. Create the keymap variable ‘NAME-speedbar-key-map’.
2. Create a function, named whatever you like, which assigns values
into your keymap. Use this command to create the keymap before
assigning bindings:
(setq NAME-speedbar-key-map (speedbar-make-specialized-keymap))
This function creates a special keymap for use in speedbar.
3. Call your install function, or assign it to a hook like this:
(if (featurep 'speedbar)
(NAME-install-speedbar-variables)
(add-hook 'speedbar-load-hook 'NAME-install-speedbar-variables))
4. Create an easymenu compatible vector named
‘NAME-speedbar-menu-items’. This will be spliced into speedbar’s
control menu.
5. Create a function called ‘NAME-speedbar-buttons’. This function
should take one variable, which is the buffer for which it will
create buttons. At this time ‘(current-buffer)’ will point to the
uncleared speedbar buffer.
When writing ‘NAME-speedbar-buttons’, the first thing you will want
to do is execute a check to see if you need to re-create your display.
If it needs to be cleared, you need to erase the speedbar buffer
yourself, and start drawing buttons. Creating a display.