FrameBufs

The frame-bufs packages extends Emacs’s buffer menu so that it understands a distinction between those buffers that “belong” to a frame and those that do not. The buffer menu can be toggled between listing all buffers and listing only those buffers associated with the selected frame. The criteria governing which buffers are associated with a frame can be customized through various options. In addition, buffers can be manually added to and removed from the list of buffers associated with a frame.

The package interacts properly with other-buffer and respects changes in buffer ordering made by bury-buffer. It does not alter the buffer-list or buried-buffer-list frame parameters. It is not compatible with non-nil values of pop-up-frames.

Installation

Put the package file frame-bufs.el in your load path and put:

    (require 'frame-bufs)

in your .emacs. To enable frame-bufs, use the command frame-bufs-mode, or put (frame-bufs-mode t) in your .emacs.

Note that frame-bufs.el has a bug in frame-bufs--ok-to-display-p:

    (or (not (functionp other-pred) (funcall other-pred buf)))

This should be:

    (or (not (functionp other-pred)) (funcall other-pred buf))

Or perhaps:

    (and (functionp other-pred) (funcall other-pred buf))

The author doesn’t have their code in source control or any place where I can submit a patch, and I’m reluctant to just edit their code in this wiki, so I’m noting it here.

Features Overview

When frame-bufs-mode is enabled, it keeps a record of which buffers are associated with each frame. In the typical case, a buffer becomes associated with a frame when it is selected in one of that frame’s windows. Note, then, that a buffer can be associated with more than one frame.

The buffer menu now has two modes: It can either list all buffers (we call this “global mode”) or only buffers associated with the selected frame (“local mode”). By typing F one can toggle between the two modes. In global mode there is an additional column after the initial CRM bit columns: the F column. Buffers associated with the selected frame are indicated with an o in this column. In local mode, the fourth column is suppressed. Here are screenshots of the buffer menu in the two different modes:

FrameBufsLocalMode

/Buffer menu in local mode, sorted by buffer size. Only buffers associated with this frame are shown. /

FrameBufsFullMode

/Buffer menu in global mode, sorted by buffer size. All buffers are shown; the buffers associated with this frame are distinguished by an ‘o’ in the fourth bit column. /

When first called up, the buffer menu appears in global mode. In subsequent calls it opens in whatever mode it was last in.

In addition to toggling between the two modes, there are two other new commands available in the buffer menu:

As with saving and killing buffers from the buffer menu, these requested changes are effected by calling Buffer-menu-execute.

Further Control of the Local Buffer List

As mentioned above, a buffer automatically becomes associated with a frame if it is selected in one of that frame’s windows. Finer-grained control over which buffers are automatically associated with a frame is provided by the following variables:

Other Commands and Features