Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!mit-eddie!YALE.ARPA!ram-ashwin From: ram-ashwin@YALE.ARPA (Ashwin Ram) Newsgroups: comp.emacs Subject: Re: walk-windows Message-ID: <8711171527.AA01701@ATHENA.CS.YALE.EDU> Date: Tue, 17-Nov-87 10:27:03 EST Article-I.D.: ATHENA.8711171527.AA01701 Posted: Tue Nov 17 10:27:03 1987 Date-Received: Thu, 19-Nov-87 21:04:48 EST Sender: daemon@eddie.MIT.EDU Lines: 33 Oops... The starting count for count-windows should indeed be 0. There was a minor bug in walk-windows. Here's the corrected code: (defun walk-windows (proc &optional no-mini) "Applies PROC to each visible window. Optional arg NO-MINI non-nil means don't apply PROC to the minibuffer even if it is active." (let ((start (selected-window)) (current (next-window (selected-window) no-mini))) (funcall proc start) (while (not (eq current start)) (funcall proc current) (setq current (next-window current no-mini))))) (defun count-windows (&optional no-mini) "Returns the number of visible windows. Optional arg NO-MINI non-nil means don't count the minibuffer even if it is active." (let ((count 0)) (walk-windows (function (lambda (w) (ignore w) (setq count (+ count 1)))) no-mini) count)) Thanks for the feedback. -- Ashwin Ram -- ARPA: Ram-Ashwin@cs.yale.edu UUCP: {decvax,linus,seismo}!yale!Ram-Ashwin BITNET: Ram@yalecs