Function: current-window-configuration

current-window-configuration is a function defined in window.c.

Signature

(current-window-configuration &optional FRAME)

Documentation

Return an object representing the current window configuration of FRAME.

If FRAME is nil or omitted, use the selected frame. This describes the number of windows, their sizes and current buffers, and for each displayed buffer, where display starts, and the position of point. An exception is made for point in the current buffer: its value is -not- saved. This also records the currently selected frame, and FRAME's focus redirection (see redirect-frame-focus). The variable window-persistent-parameters specifies which window parameters are saved by this function.

View in manual

Probably introduced at or before Emacs version 18.

Source Code

// Defined in /usr/src/emacs/src/window.c
{
  struct frame *f = decode_live_frame (frame);
  ptrdiff_t n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f)));
  struct save_window_data *data
    = ALLOCATE_PSEUDOVECTOR (struct save_window_data, saved_windows,
			     PVEC_WINDOW_CONFIGURATION);
  data->frame_cols = FRAME_COLS (f);
  data->frame_lines = FRAME_LINES (f);
  data->frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f);
  data->frame_tab_bar_lines = FRAME_TAB_BAR_LINES (f);
  data->frame_tool_bar_lines = FRAME_TOOL_BAR_LINES (f);
  data->frame_text_width = FRAME_TEXT_WIDTH (f);
  data->frame_text_height = FRAME_TEXT_HEIGHT (f);
  data->frame_menu_bar_height = FRAME_MENU_BAR_HEIGHT (f);
  data->frame_tab_bar_height = FRAME_TAB_BAR_HEIGHT (f);
  data->frame_tool_bar_height = FRAME_TOOL_BAR_HEIGHT (f);
  data->selected_frame = selected_frame;
  data->current_window = FRAME_SELECTED_WINDOW (f);
  XSETBUFFER (data->f_current_buffer, current_buffer);
  data->minibuf_scroll_window = minibuf_level > 0 ? Vminibuf_scroll_window : Qnil;
  data->minibuf_selected_window = minibuf_level > 0 ? minibuf_selected_window : Qnil;
  data->root_window = FRAME_ROOT_WINDOW (f);
  data->focus_frame = FRAME_FOCUS_FRAME (f);
  Lisp_Object tem = make_nil_vector (n_windows);
  data->saved_windows = tem;
  for (ptrdiff_t i = 0; i < n_windows; i++)
    ASET (tem, i, make_nil_vector (VECSIZE (struct saved_window)));
  save_window_save (FRAME_ROOT_WINDOW (f), XVECTOR (tem), 0);
  XSETWINDOW_CONFIGURATION (tem, data);
  return tem;
}