[gnu.emacs] Multiple windows with multiple arguments ?

paulr@sequent.UUCP (Paul Reger) (09/21/89)

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 ?????

			paulr    (Paul Reger)
	      Sequent Computer Systems, Beaverton Oregon
	     {uunet,ucbvax!rutgers!ogccse}!sequent!paulr

kjones@talos.uucp (Kyle Jones) (09/22/89)

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   <kjones@talos.uu.net>   ...!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"))))