Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!bloom-beacon!gatech!mcnc!decvax!ucbvax!LF-SERVER-2.BBN.COM!jr From: jr@LF-SERVER-2.BBN.COM (John Robinson) Newsgroups: comp.emacs Subject: Re: How many windows? Message-ID: <8711091632.AA27117@ucbvax.Berkeley.EDU> Date: Mon, 9-Nov-87 11:32:23 EST Article-I.D.: ucbvax.8711091632.AA27117 Posted: Mon Nov 9 11:32:23 1987 Date-Received: Wed, 11-Nov-87 06:15:41 EST References: <231@usl-pc.UUCP> Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: jr@ALEXANDER.BBN.COM Organization: The ARPA Internet Lines: 45 >> Is there any way to find out how many windows are on the screen in a >> Elisp program (GNU Emacs version 18.??). Yes. There is a lisp structure that tracks what buffers are visible. >> I have a program that I want >> to automatically split the screen into two windows, ONLY two windows, >> that is, if we already have two windows on the screen, we DON'T want >> to split into THREE windows. Emacs' functions that pop up windows generally won't go from two to three windows. For example: odisplay-buffer: Make BUFFER appear in some window but don't select it. BUFFER can be a buffer or a buffer name. If BUFFER is shown already in some window, just uses that one, unless the window is the selected window and NOTTHISWINDOW is non-nil. Returns the window displaying BUFFER. and pop-to-buffer: Select buffer BUFFER in some window, preferably a different one. If pop-up-windows is non-nil, windows can be split to do this. If second arg OTHER-WINDOW is non-nil, insist on finding another window even if BUFFER is already visible in the selected window. The mh-e package (lisp/mh-e.el) has a fairly crufty example of how to arrange the screen to have a particular appearance: ;; These contortions are to force the summary line to be the top window. (switch-to-buffer-other-window folder) (delete-other-windows) (switch-to-buffer-other-window mh-show-buffer) (switch-to-buffer-other-window folder) (shrink-window (- (window-height) mh-summary-height)) (recenter 1) which makes the top window be mh-summary-height on buffer "folder", and the rest of the screen (except the minibuffer) be on the buffer "mh-show-buffer". /jr jr@bbn.com or jr@bbn.nLro