Subject: Re: bug#10971: Problem with `split-window-keep-point' set to `nil'

From: martin rudalics <[email-masked]>
Date: Fri, 09 Mar 2012 17:24:24 +0100

> Does the attached patch give better results?

Just to explain what IMO happened and maybe should happen here: Emacs 23
had a wrapper

       (save-excursion
	(set-buffer (window-buffer))

which, probably to avoid a warning, Stefan changed on 2009-11-13 to

       (with-current-buffer (window-buffer)

Ever since that `split-window-keep-point' was broken and the fact that
nobody complained till now seems to indicate that we probably should
obsolete this option.

I don't understand the purpose of the (set-buffer (window-buffer)).
Maybe it was due to the fact that the current buffer might not be the
window buffer of the selected window when `split-window-vertically' is
called.  In that case, however, the specification of `old-point' and the
conjunct

	   (<= bottom (point))

some lines below _would_ consult the current buffer (since it's outside
the `save-excursion') and we'd have a problem anyway.

OTOH, not using `save-excursion' is the wrong thing since everything
done in the excursion is to _calculate_ positions and not to modify
them.  My patch is an attempt to fix most old and new issues with one
exception: The let's

	(old-point (point))

should probably become

	(old-point (window-point-1))

but I'm not very sure yet.  Any ideas?

martin