Function: window-buffer

window-buffer is a function defined in window.c.

Signature

(window-buffer &optional WINDOW)

Documentation

Return the buffer displayed in window WINDOW.

If WINDOW is omitted or nil, it defaults to the selected window. Return nil for an internal window or a deleted window.

Other relevant functions are documented in the buffer group.

Shortdoc

;; buffer
(window-buffer)
    => #<buffer *scratch*>

Source Code

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

  return WINDOW_LEAF_P (w) ? w->contents : Qnil;
}