![]() |
Links between buffers, views and windows | ![]() |
A buffer may have several views, and each view is displayed in at most one window, which displays exactly one view. The following routines, documented on the previous pages, convert between the three kinds of objects; those which may fail return #f:
|
||||||||||||||||||||||||
The current buffer is always the buffer of the current view, and the current window the window of the current view, if any. Changing one of them thus changes the others:
(switch-to-buffer buf) displays in the current window a view on buf which is not displayed elsewhere (a new one is made if needed), and makes it the current view;
(window-set-buffer win buf) and (window-set-view win vw focus?) do the same for another window;
(buffer-focus buf) and (with-buffer buf …) make a view on buf the current view without changing what the windows display, which is how routines act on a buffer which is not displayed;
(switch-to-window win) and (window-focus win) make the view of win the current one.
A view which is not displayed in any window still holds an editor, so that the document can be typeset and modified (for instance by with-buffer); (view-delete vw) removes it. Closing a buffer deletes all its views, and the windows which displayed them switch to another buffer. See the server: buffers, views and windows for the C++ side.