Path: utzoo!utgpu!watmath!uunet!talos!kjones
From: kjones@talos.uucp (Kyle Jones)
Newsgroups: gnu.emacs
Subject: Re: Multiple windows with multiple arguments ?
Message-ID: <1989Sep22.135341.5802@talos.uucp>
Date: 22 Sep 89 13:53:41 GMT
References: <22003@sequent.UUCP>
Reply-To: kjones@talos.uu.net
Distribution: gnu
Lines: 28

Paul Reger writes:
 > I was wondering if it would be possible in emacs if:
 > you invoke emacs with 2 or more files:
 > 
 > emacs file1 file2 file3 ... filen
 > 
 > have emacs come up with two windows, one window containing one file
 > and the other window another file, Or maybe go into a *Buffer List*
 > buffer ?????

Here's code to implement this.  Editing zero or one file works normally,
two files gives you a split screen, three or more files runs buffer-menu.

kyle jones      ...!uunet!talos!kjones
-------- put the following code in your .emacs ------------
(defun auto-buffer-menu ()
  ;; This code is slightly unclean; it relies on Emacs starting up with
  ;; exactly two buffers present: "*scratch*" and " *Minibuf-0*".
  (let ((list (buffer-list)))
    (cond ((> (length list) 4)
	   (buffer-menu t)
	   (delete-other-windows))
	  ((= (length list) 4)
	   (pop-to-buffer nil)))))

(if (cdr command-line-args)
    (setq command-line-args
	  (nconc command-line-args '("-f" "auto-buffer-menu"))))