emacs-jp/elscreen — pull request #6 by debug-ito (2014-07-06 01:13:54+00:00)
Title: Fix elscreen-save-screen-excursion messing with window histories

`elscreen-save-screen-excursion` messed up "window histories", which was introduced to Emacs recently.

http://www.gnu.org/software/emacs/manual/html_node/elisp/Window-History.html

This patch fixes the problem by saving and restoring the window histories.

Without this patch, messed up window histories cause an annoying behavior: when you `kill-buffer` the current buffer, it shows one of the buffers displayed in other screens instead of the buffer previously shown in the window.

For example, suppose you have the following screens.

[0- *scratch*]
[1+ a.txt]

Then you open `b.txt` in Screen 1.

[0- *scratch*]
[1+ b.txt]

Then you `kill-buffer` the current buffer (`b.txt`), expecting it is replaced with `a.txt`. However, the result is

[0- *scratch*]
[1+ *scratch*]

This is pretty annoying.

I tested the patch in the following Emacs versions with no problem.

* Emacs 24.3.1 (Xubuntu 14.04)
* It supports window histories.
* The `kill-buffer` problem exists.
* The patch fixed the problem.
* Emacs 24.2.1 (Windows 7)
* It supports window histories.
* The `kill-buffer` problem does NOT exist. I don't know why.
* Emacs 23.3.1 (Xubuntu 12.04)
* It does not support window histories.
* The patch causes no problem.