Next: , Previous: , Up: Windows   [Contents][Index]

29.19 Windows and Point

Each window has its own value of point (see Point), independent of the value of point in other windows displaying the same buffer. This makes it useful to have multiple windows showing one buffer.

Emacs displays the cursor, by default as a rectangular block, in each window at the position of that window’s point. When the user switches to another buffer in a window, Emacs moves that window’s cursor to where point is in that buffer. If the exact position of point is hidden behind some display element, such as a display string or an image, Emacs displays the cursor immediately before or after that display element.

Function: window-point &optional window

This function returns the current position of point in window. For a nonselected window, this is the value point would have (in that window’s buffer) if that window were selected. The default for window is the selected window.

When window is the selected window, the value returned is the value of point in that window’s buffer. Strictly speaking, it would be more correct to return the top-level value of point, outside of any save-excursion forms. But that value is hard to find.

Function: set-window-point window position

This function positions point in window at position position in window’s buffer. It returns position.

If window is selected, this simply does goto-char in window’s buffer.

Variable: window-point-insertion-type

This variable specifies the marker insertion type (see Marker Insertion Types) of window-point. The default is nil, so window-point will stay behind text inserted there.

Function: set-window-cursor-type window type

This function sets the cursor shape for window. This setting takes precedence over the cursor-type variable, and type has the same format as the value of that variable. See Cursor Parameters. If window is nil, it means to set the cursor type for the selected window.

The initial value for new windows is t, which says to respect the buffer-local value of cursor-type. The value set by this function persists across buffers shown in window, so set-window-buffer does not reset it. See Buffers and Windows.

Function: window-cursor-type &optional window

This function returns the cursor type of window, defaulting to the selected window.

Next: The Window Start and End Positions, Previous: Atomic Windows, Up: Windows   [Contents][Index]