[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

28.6 Buffers and Windows

This section describes low-level functions to examine windows or to display buffers in windows in a precisely controlled fashion. Voir la section Displaying Buffers in Windows, for related functions that find a window to use and specify a buffer for it. The functions described there are easier to use than these, but they employ heuristics in choosing or creating a window; use these functions when you need complete control.

Function: set-window-buffer window buffer-or-name &optional keep-margins

This function makes window display buffer-or-name as its contents. It returns nil. buffer-or-name must be a buffer, or the name of an existing buffer. This is the fundamental primitive for changing which buffer is displayed in a window, and all ways of doing that call this function.

 
(set-window-buffer (selected-window) "foo")
     ⇒ nil

Normally, displaying buffer in window resets the window's display margins, fringe widths, scroll bar settings, and position based on the local variables of buffer. However, if keep-margins is non-nil, the display margins and fringe widths of window remain unchanged. Voir la section Fringes.

Variable: buffer-display-count

This buffer-local variable records the number of times a buffer is displayed in a window. It is incremented each time set-window-buffer is called for the buffer.

Function: window-buffer &optional window

This function returns the buffer that window is displaying. If window is omitted, this function returns the buffer for the selected window.

 
(window-buffer)
     ⇒ #<buffer windows.texi>
Function: get-buffer-window buffer-or-name &optional all-frames

This function returns a window currently displaying buffer-or-name, or nil if there is none. If there are several such windows, then the function returns the first one in the cyclic ordering of windows, starting from the selected window. Voir la section Cyclic Ordering of Windows.

The argument all-frames controls which windows to consider.

Function: get-buffer-window-list buffer-or-name &optional minibuf all-frames

This function returns a list of all the windows currently displaying buffer-or-name.

The two optional arguments work like the optional arguments of next-window (voir la section Cyclic Ordering of Windows); they are not like the single optional argument of get-buffer-window. Perhaps we should change get-buffer-window in the future to make it compatible with the other functions.

Variable: buffer-display-time

This variable records the time at which a buffer was last made visible in a window. It is always local in each buffer; each time set-window-buffer is called, it sets this variable to (current-time) in the specified buffer (voir la section Time of Day). When a buffer is first created, buffer-display-time starts out with the value nil.


[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

Ce document a été généré par Eric Reinbold le 13 Octobre 2007 en utilisant texi2html 1.78.