As Tobias mentioned, Emacs 25 shows exactly my wanted behavior. I found that the problem comes from the following codes I copied from https://www.emacswiki.org/emacs/EdiffMode
(add-hook 'ediff-load-hook
(lambda ()
(add-hook 'ediff-before-setup-hook
(lambda ()
(setq ediff-saved-window-configuration (current-window-configuration))))
(let ((restore-window-configuration
(lambda ()
(set-window-configuration ediff-saved-window-configuration))))
(add-hook 'ediff-quit-hook restore-window-configuration 'append)
(add-hook 'ediff-suspend-hook restore-window-configuration 'append))))
To fix it, I changed the last lambda function to:
(lambda ()
(save-excursion
(set-window-configuration ediff-saved-window-configuration))
(recenter nil))
GNU Emacs 25.1.50.2 (i686-pc-linux-gnu, GTK+ Version 3.10.8) of 2016-04-25
shows exactly your wanted behavior. Please retry withemacs -Q
. If you get the wanted behavior withemacs -Q
the unwanted behavior is caused by the system configuration or your configuration. You can test whether it is caused by the system configuration byemacs -q
.