I would like to use ediff-current-file to jump to some of my previous changes/edits. However, when I type 'q' to quit ediff after calling ediff-current-file and navigation (using 'p'/'n'), the cursor always jumps to the change near the end of the file.

Is it possible to stay at the line I chosen during ediff?

  • GNU Emacs (i686-pc-linux-gnu, GTK+ Version 3.10.8) of 2016-04-25 shows exactly your wanted behavior. Please retry with emacs -Q. If you get the wanted behavior with emacs -Q the unwanted behavior is caused by the system configuration or your configuration. You can test whether it is caused by the system configuration by emacs -q.
    – Tobias
    Commented Feb 2, 2017 at 2:29
  • 1
    You are right! I found that my setting about restore-window-configuration changed the behavior. Thanks!
    – AhLeung
    Commented Feb 2, 2017 at 8:00
  • Please, answer your question and accept your answer. That marks this question as solved in the overview. Thanks in advance. Note, that you should not delete the question since the problem may happen to others too.
    – Tobias
    Commented Feb 2, 2017 at 8:04

1 Answer 1


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 ()
     (set-window-configuration ediff-saved-window-configuration))
  (recenter nil))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.