## 15 Frames and Windows ¶

VM uses Emacs frames and windows to display messages and summaries and to provide a place for you to compose messages. Using VM’s frame configuration facilities you can control when VM creates new frames and the size and attributes associated with new frames. Inside each frame you can associate different window setups with commands and classes of commands by using VM’s window configuration facilities.

To use VM’s frame configuration features, the variable `vm-mutable-frame-configuration` must be set non-`nil`. This is the default. If `vm-mutable-frame-configuration` is set to `nil` VM will only use the current frame, and VM will not create, delete or resize frames. (This variable was called `vm-mutable-frames` in versions prior to 8.2.)

To use window configurations, the variable `vm-mutable-window-configuration` must be set non-`nil`. If `vm-mutable-window-configuration` is set to `nil`, VM will only use the selected window, and will not create, delete or resize windows. (This variable was called `vm-mutable-windows` in versions prior to 8.2.)

### 15.1 Frame Configuration ¶

VM has a set of variables that let you specify when VM creates frames and what attributes the new frames will have.

If `vm-frame-per-folder` is set non-`nil`, when you visit a folder, VM will create a new frame and display that folder in the new frame. When you quit the folder, VM will delete the frame.

If `vm-frame-per-summary` is set non-`nil`, the `vm-summarize` command will create a new frame in which to display a folder’s summary buffer. This works best if a full-screen window configuration has been assigned to the `vm-summarize` command. When you quit the folder or kill the summary, VM will delete the frame.

Setting `vm-frame-per-composition` non-`nil` causes VM to create a new frame for the composition buffer when you run any of VM’s message composition commands. E.g. `vm-reply-include-text`, `vm-mail`, `vm-forward-message`. When you finish editing the composition and send it, or when you kill the composition buffer, the frame will be deleted.

The variable `vm-frame-per-edit`, if non-`nil`, tells VM to create a new frame when the vm-edit-message command is run. When you finish editing the message, or abort the edit, the frame will be deleted.

If `vm-frame-per-help` is set non-`nil`, VM will create a new frame to display any help buffer produced by the vm-help command.

If `vm-frame-per-completion` is set non-`nil`, VM will create a new frame on mouse initiated completing reads. A mouse initiated completing read occurs when you invoke a VM command using the mouse, either with a menu or a toolbar button. That command must then prompt you for information, and there must be a limited set of valid responses. If these conditions are met and `vm-frame-per-completion`’s value is non-`nil`, VM will create a new frame containing a list of responses that you can select with the mouse.

When VM is deciding whether to create a new frame, it checks other existing frames to see if a buffer that it wants to display in a frame is already being displayed somewhere. If so, then VM will not create a new frame. If you don’t want VM to search other frames, set the variable `vm-search-other-frames` to `nil`. VM will still search the currently selected frame and will not create a new frame if the buffer that it wants to display is visible there.

The variable `vm-frame-parameter-alist` allows you to specify the frame parameters for newly created frames.

The value of `vm-frame-parameter-alist` should be of this form

    ((SYMBOL PARAMLIST) (SYMBOL2 PARAMLIST2) ...)

SYMBOL must be one of “completion”, “composition”, “edit”, “folder”, “primary-folder” or “summary”. It specifies the type of frame that the following PARAMLIST applies to.

`completion`

  specifies parameters for frames that display lists of choices generated by a mouse-initiated completing read. (See `vm-frame-per-completion`.)

`composition`

  specifies parameters for mail composition frames.

`edit`

  specifies parameters for message edit frames (e.g. created by `vm-edit-message-other-frame`)

`folder`

  specifies parameters for frames created by ‘vm’ and the `vm-visit-` commands.

`primary-folder`

  specifies parameters for the frame created by running `vm` without any arguments.

`summary`

  specifies parameters for frames that display a summary buffer (e.g. created by `vm-summarize-other-frame`)

PARAMLIST is a list of pairs as described in the documentation for the function `make-frame`.

### 15.2 Window Configuration ¶

Window configurations allow you to specify how the windows within a frame should look for a particular command or class of commands. Each command can have a configuration associated with it and you can also associate a configuration with command classes like “reading-message” or “composing-message”. To setup a window configuration, first use Emacs’ window management commands (`split-window`, `enlarge-window`, etc.) to make the windows in the frame look the way you want. Then use the switch-to-buffer command to put the buffers you want to see into the windows. Next type `W S`, which invokes the `vm-save-window-configuration` command. Type the name of the command or class of commands to which you want the configuration to apply. Nearly all VM commands can be entered here. Valid classes are:

        default
        startup
        quitting
        reading-message
        composing-message
        marking-message
        searching-message

When a VM command is executed, window configurations are searched for as follows. First, a command specific configuration is searched for. If one is found, it is used. Next a class configuration is searched for. Not all commands are in command classes. Message composition commands are in the “composing-message” class. All the `vm-quit*` commands are in the “quitting” class. All the VM commands that set and clear message marks are in the “marking-message” class, and so on. If such a class configuration is found it is used. If no matching class configuration is found, the “default” class configuration is used, if it is defined.

Note that when a window configuration is saved the selected window at that time will be the selected window when that window configuration is used. So if you prefer for the cursor to be in a particular window, make sure you invoke `vm-save-window-configuration` window from that window. Remember that you can invoke the command with `M-x` if VM’s normal key map is not in effect.

To delete a window configuration, use `W D` which is bound to `vm-delete-window-configuration`. You will be prompted for the name of the configuration to delete.

To see what an existing configuration looks like, type `W W` which invokes `vm-apply-window-configuration`.

VM saves information about your window configurations in the file named by the variable `vm-window-configuration-file`. The default location of the configuration file is `"~/.vm.windows"`. Do not make `vm-window-configuration-file` point to the same location as `vm-init-file`, as the window configuration save commands will then overwrite the content of your init file.