Special Frames

This page is part of the description of OneOnOneEmacs, by DrewAdams.

Emacs lets you “make certain chosen buffers, for which Emacs normally creates a second window when you have just one window, appear in special Frames of their own” (from the EmacsManual).

So, I did. This may not have a grand utility, but it does make it clear when a special buffer is involved – and you can give these special frames different properties from normal frames. Here is a screenshot of a frame for a special buffer (*Occur*) and a normal buffer (elect-mbuf.el):


More importantly, perhaps: special buffers are effectively in dedicated frames (you cannot dissociate the buffer and its frame).

So, what’s a “special buffer” (aka special display buffer)? Any buffer that corresponds to ‘special-display-regexps’ or ‘special-display-buffer-names’. In my case, ‘special-display-regexps’ is just "[ ]?[*][^*]+[*]", so buffers that start and end with an asterisk (*) are displayed in special frames. Examples: *grep*, *Messages*, *scratch*.

Special frames are similar to dedicated Emacs windows (windows satisfying predicate ‘window-dedicated-p’): function ‘display-buffer’ does not use a window or frame that is dedicated to its buffer to display a different buffer.

Treating frames the way windows are usually treated also meant modifying a few existing functions that treat dedicated windows specially. For example, I modified command ‘Buffer-menu-select’ so that it uses ‘pop-to-buffer’ (which uses a new frame, provided ‘pop-to-frames’ is non-nil) whenever a window is dedicated to its buffer (‘window-dedicated-p’).

See Library: oneonone.el

Invisible Special Frames

Since special frames are dedicated to their buffers, it doesn’t make much sense to delete them. An alternative to iconifying them when they are no longer needed is to make them invisible. An invisible frame is just what the name says: it is neither visible nor iconified – nothing representing it is visible.

I modified several commands to make special frames invisible instead of deleting them or iconifying them.

For example, command ‘remove-window’ is like ‘delete-window’, but it treats one-on-one windows this way: If the window is dedicated to its buffer, then its frame is made invisible. Otherwise, its frame (as well as the window) is deleted. ‘remove-window’ is the command I use to replace ‘delete-window’ interactively (even my redefined version – see Delete Frames Easily - But Not Too Easily#Redefineddelete-window):

  (substitute-key-definition 'delete-window

Command ‘mouse-remove-window’ ([mode-line C-mouse-3]) is the mouse equivalent of ‘remove-window’.

See Libraries: frame-cmds.el, setup-keys.el

The ‘special-display-regexps’ and‘special-display-buffer-names’ are obsolete since GNU Emacs 24.3, as they can be replaced by appropriate entries in the ‘display-buffer-alist’ function. – XueFuqiao

OneOnOneEmacs CategoryFrames FrameModes CategoryDisplay CategoryGlossary