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.
Create the keymap variable
name-speedbar-mode-map.Create a function, named whatever you like, which assigns values into your keymap. Use this command to create the keymap before assigning bindings:
emacs-lisp(setq name-speedbar-mode-map (speedbar-make-specialized-keymap))This function creates a special keymap for use in speedbar.
Call your install function, like this:
emacs-lisp(with-eval-after-load 'speedbar (name-install-speedbar-variables))Create an easymenu compatible vector named
name-speedbar-menu-items. This will be spliced into speedbar’s control menu.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. See Creating a display.