[comp.emacs] non disctructive split-window

mende@athos.rutgers.edu (Bob Mende) (01/21/88)

Hi ...
   Is there any way to have split a buffer to get the following
effects (either would be nice)...

Original config...
	------------------------------------------------------
	|                                                    |
	|        Buffer No. 1                                |
	------------------------------------------------------
	|                                                    |
	|        Buffer No. 2                                |
	------------------------------------------------------
(switch-to-buffer "Buffer No. 2")
(split-window (selected-window))
(pop-to-buffer "Buffer No. 3")   *** I am not sure this is the right
				     command ***
.... so we now have  ...
	------------------------------------------------------
	|                                                    |
	|        Buffer No. 1                                |
	------------------------------------------------------
	|        Buffer No. 2                                |
	------------------------------------------------------
	|        Buffer No. 3                                |
	------------------------------------------------------
(delete-window)   ****Buffer No. 3****
...and *return* to the orig configuration.

  Basicly I want to only modify the current buffer/window (if possible)
when I do a split.   The reason I want this is that I have elisp code
that needs to know the where the point last was when it was outside of
Buffer No. 3.   Plus it would be nice to split a window... and then
get the same sized windows as when I started.   does anyone know of
anyway to do this is GnuEmacs 18.49?

					Thanks...

						/Bob
-- 
     mende@rutgers.edu    {...}!rutgers!mende    mende@zodiac.bitnet

I am a jelly donut.  I am a jelly donut.

jr@LF-SERVER-2.BBN.COM (John Robinson) (01/21/88)

This function might be of use to you, assuming you are doing this
in elisp code:

  save-window-excursion:
  Execute body, preserving window sizes and contents.
  Restores which buffer appears in which window, where display starts,
  as well as the current buffer.
  Does not restore the value of point in current buffer.

If you need to preserve point, you probably also want:

  save-excursion:
  Save point (and mark), execute BODY, then restore point and mark.
  Executes BODY just like PROGN.  Point and mark values are restored
  even in case of abnormal exit (throw or error).

/jr
jr@bbn.com or jr@bbn.uucp