Function: window-total-width

window-total-width is a function defined in window.c.

Signature

(window-total-width &optional WINDOW ROUND)

Documentation

Return the total width of window WINDOW in columns.

WINDOW must be a valid window and defaults to the selected one.

The return value includes the widths of WINDOW's fringes, margins, scroll bars and its right divider, if any. If WINDOW is an internal window, the total width is the width of the screen areas spanned by its children.

If WINDOW's pixel width is not an integral multiple of its frame's character width, the number of lines occupied by WINDOW is rounded internally. This is done in a way such that, if WINDOW is a parent window, the sum of the total widths of all its children internally equals the total width of WINDOW.

If the optional argument ROUND is ceiling, return the smallest integer larger than WINDOW's pixel width divided by the character width of WINDOW's frame. ROUND floor means to return the largest integer smaller than WINDOW's pixel width divided by the character width of WINDOW's frame. Any other value of ROUND means to return the internal total width of WINDOW.

View in manual

Probably introduced at or before Emacs version 24.1.

Source Code

// Defined in /usr/src/emacs/src/window.c
{
  struct window *w = decode_valid_window (window);

  if (! EQ (round, Qfloor) && ! EQ (round, Qceiling))
    return make_fixnum (w->total_cols);
  else
    {
      int unit = FRAME_COLUMN_WIDTH (WINDOW_XFRAME (w));

      return make_fixnum (EQ (round, Qceiling)
			  ? ((w->pixel_width + unit - 1) /unit)
			  : (w->pixel_width / unit));
    }
}