3

I am trying to compare two log files, side by side in two emacs buffers. The logfiles are similar in context, but some have extra debug inserted. This makes simple use of pgup/pgdown painful as things get out of alignment between the two buffers.

What I'd like to do is scroll by context, and although I don't expect emacs to know the context, I'd like to find the relevant line in the left and right buffers and then scroll both buffers such that that line appears at the top of the window in both buffers.

Is this achievable?

  • 1
    I don't know a packge which does that. But I'd love to have one. You can easily match-up the lines of the two files by running "diff" on them, so it's only a matter of writing the package which processes diff's output and then uses it in a scroll-hook. – Stefan Oct 30 '15 at 13:12
  • 2
    Why don't you use Ediff for this? M-x ediff-buffers. – Drew Oct 30 '15 at 18:07
2

You can :

  • go to the right relevant line (with isearch C-s 'pattern') and do C-l (recenter-top-bottom) 2 times.

  • go to the left relevant line (same iseach C-s C-s) and do C-l 2 times.

the two buffers will be align.

The cursor will be at top position if scroll-margin == 0 (default value). if not, add (setq scroll-margin 0) to your .emacs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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