changeset 66310:c7bbd7c2f47c

(get-buffer-window-list): Moved from subr.el.
author Richard M. Stallman <rms@gnu.org>
date Sat, 22 Oct 2005 15:35:06 +0000
parents 3bea1353ceed
children cf092daa39de
files lisp/window.el
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/window.el	Sat Oct 22 15:34:37 2005 +0000
+++ b/lisp/window.el	Sat Oct 22 15:35:06 2005 +0000
@@ -192,6 +192,18 @@
 
 (defalias 'some-window 'get-window-with-predicate)
 
+;; This should probably be written in C (i.e., without using `walk-windows').
+(defun get-buffer-window-list (buffer &optional minibuf frame)
+  "Return list of all windows displaying BUFFER, or nil if none.
+BUFFER can be a buffer or a buffer name.
+See `walk-windows' for the meaning of MINIBUF and FRAME."
+  (let ((buffer (if (bufferp buffer) buffer (get-buffer buffer))) windows)
+    (walk-windows (function (lambda (window)
+			      (if (eq (window-buffer window) buffer)
+				  (setq windows (cons window windows)))))
+		  minibuf frame)
+    windows))
+
 (defun minibuffer-window-active-p (window)
   "Return t if WINDOW (a minibuffer window) is now active."
   (eq window (active-minibuffer-window)))