Skip to content

Window Configurations

This chapter explains Hyperbole’s hywconfig.el library. It lets you save and restore window configurations, i.e. the layout of windows and buffers displayed within an emacs frame. This is useful to save a particular working context and then to jump back to it at a later time during an emacs session. It is also useful during demonstrations to display many informational artifacts all at once, e.g. all of the windows for a particular subsystem. None of this information is stored between emacs sessions, so your window configurations will last through only a single session of use. Each window configuration is tied to the emacs frame in which it is created.

The hywconfig library offers two independent ways of managing window configurations. The first way associates a name with each stored window configuration. The name may then be used to retrieve the window configuration later. The second way uses a ring structure to save window configurations and then allows cycling through the ring of saved configurations, finally wrapping around to the first entry after the last entry is encountered. Simply stop when the desired configuration is displayed.

The Win/ menu entry on the Hyperbole top-level menu displays a menu of hywconfig window configuration commands:

WinConfig>  AddName  DeleteName  RestoreName  PopRing  SaveRing  YankRing

The operations on this menu are defined as follows.

Menu Item       Command                     Description
=====================================================================
AddName         hywconfig-add-by-name       Name current wconfig
DeleteName      hywconfig-delete-by-name    Delete wconfig by name
RestoreName     hywconfig-restore-by-name   Restore wconfig by name

PopRing         hywconfig-delete-pop        Restore and delete wconfig
SaveRing        hywconfig-ring-save         Store wconfig to the ring
YankRing        hywconfig-yank-pop          Restore the next wconfig
=====================================================================

The easiest method to save and restore window configurations shown here is by name, but it requires that you type the chosen name. Instead, the ring commands permit saves and restores using only the mouse. Since the ring commands are a bit more complex than their by-name counterparts, the following paragraphs explain them in more detail.

HyWconfig creates a ring structure that operates just like the Emacs kill-ring (see Kill Ring in the GNU Emacs Manual) but its elements are window configurations rather than text regions. You can add an element to the ring to save the current window configuration in the selected frame. After several elements are in the ring, you can walk through all of them in sequence until the desired configuration is restored.

SaveRing executes the hywconfig-ring-save command which saves the current window configuration to the ring.

YankRing executes the hywconfig-yank-pop command. It restores the window configuration currently pointed to within the ring. It does not delete this configuration from the ring but it does move the pointer to the prior ring element. Repeated calls to this command thus restore successive window configurations until the ring pointer wraps around. Simply stop when a desired configuration appears and use {q} to quit from the minibuffer menu.

PopRing calls the hywconfig-delete-pop command. It is used to restore a previously saved configuration and to delete it from the ring. Simply stop when a desired configuration appears and use {q} to quit from the minibuffer menu.

The maximum number of elements the ring can hold is set by the hywconfig-ring-max variable whose default is 10. Any saves beyond this value will delete the oldest element in the ring before a new one is added.