Function: get-buffer-window

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

Signature

(get-buffer-window &optional BUFFER-OR-NAME ALL-FRAMES)

Documentation

Return a window currently displaying BUFFER-OR-NAME, or nil if none.

BUFFER-OR-NAME may be a buffer or a buffer name and defaults to the current buffer.

The optional argument ALL-FRAMES specifies the frames to consider:

- t means consider all windows on all existing frames.

- visible means consider all windows on all visible frames.

- 0 (the number zero) means consider all windows on all visible
    and iconified frames.

- A frame means consider all windows on that frame only.

Any other value of ALL-FRAMES means consider all windows on the selected frame and no others.

Probably introduced at or before Emacs version 19.20.

Source Code

// Defined in /usr/src/emacs/src/window.c
{
  Lisp_Object buffer;

  if (NILP (buffer_or_name))
    buffer = Fcurrent_buffer ();
  else
    buffer = Fget_buffer (buffer_or_name);

  if (BUFFERP (buffer))
    return window_loop (GET_BUFFER_WINDOW, buffer, true, all_frames);
  else
    return Qnil;
}