diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index 16b82a6a29e..9caaa5e6901 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi @@ -4939,6 +4939,11 @@ and @var{window-pos} is a marker that gives the window point position The list is ordered so that earlier elements correspond to more recently-shown buffers, and the first element usually corresponds to the buffer most recently removed from the window. + +As a rule, elements are removed from this list when their buffer gets +killed. In rare cases, however, elements may have survived the killing +of their buffer. It's a good idea therefore to always check buffers for +liveness when processing the return value of this function. @end defun @defun set-window-prev-buffers window prev-buffers diff --git a/src/window.c b/src/window.c index 792c43d0555..0373af7ef27 100644 --- a/src/window.c +++ b/src/window.c @@ -2326,7 +2326,11 @@ WINDOW must be a live window and defaults to the selected one. The return value is a list of elements (BUFFER WINDOW-START POS), where BUFFER is a buffer, WINDOW-START is the start position of the -window for that buffer, and POS is a window-specific point value. */) +window for that buffer, and POS is a window-specific point value. + +In rare ocasions BUFFER may have been already killed. It's therefore +advisable to always check the return value for the occurrence of dead +buffers before using it. */) (Lisp_Object window) { return decode_live_window (window)->prev_buffers;