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: walk-windows (final version) Message-ID: <8711181429.AA05308@ELI.CS.YALE.EDU> Date: Wed, 18-Nov-87 09:29:52 EST Article-I.D.: ELI.8711181429.AA05308 Posted: Wed Nov 18 09:29:52 1987 Date-Received: Sat, 21-Nov-87 09:45:57 EST Sender: daemon@eddie.MIT.EDU Lines: 35 A couple of people suggested that it would be nice if walk-windows selected each window before applying proc to it. I'm not sure that this is "cleaner" (since you're relying on a global somewhere to do the right thing), but it certainly is convenient. (It would be best if functions like enlarge-window took a window argument (that defaulted to the current window via an interactive spec when called interactively), so that you weren't tempted to write procs (for walk-windows and elsewhere) that did different things depending on which window was currently selected.) Anyway, here is the (hopefully) final version of walk-windows. (defun walk-windows (proc &optional no-mini) "Applies PROC to each visible window (after selecting it, for convenience). 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)) (select-window current) (funcall proc current) (setq current (next-window current no-mini))) (select-window start))) Since this function has generated quite a bit of interest, it would be nice if it became part of GNU. 'balance-windows' is certainly a useful function. -- Ashwin Ram -- ARPA: Ram-Ashwin@cs.yale.edu UUCP: {decvax,linus,seismo}!yale!Ram-Ashwin BITNET: Ram@yalecs