Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

In Emacs ediff, I can use v and V to scroll up and down the buffers that I am comparing simultaneously.

However, I have noticed that:

  1. If I start scrolling each buffer independently
  2. Then place the point (cursor) on the very first line on both buffers,
  3. Try to move them at the same time using v

Then the buffers don't scroll equally (e.g. the buffer on the rights scrolls one extra line).

I noticed that if I close the ediff session and open a new one with both files, the problem goes away though.

The files have some substantial differences near the end of the respective files, but for the first 2K lines or so they are identical.

I would be very surprised if this is a bug, so there must be something that I am not understanding. Are there any parameters that control the scrolling? The shortcuts v and V are supposed to scroll both buffers by the same amount, right?

The files that I am comparing end each line with CR LF. I have included a snapshot below from an alternative editor (Notepadd++):

   enter image description here

Note: This is with Emacs 23.3.1 (most recent stable version)

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Emacs scrolls by screen lines not physical ones, so if a physical line occupies two screen lines (due to wraparound) in one window and occupies only one screen line in the other window (due to this window being wider), then when you scroll the windows together they will get out of sync. If that's what is happening to you, you can fix the problem with

(setq truncate-partial-width-windows t)

This turns off wraparound when you split an Emacs frame down the middle, so physical lines will occupy one screen line in both windows.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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