4

This seems like such a basic feature to have in a diff mode, but I can't find anything in the documentation.

If I have two 1000 line files, and only one line is different, I want to be able to hide the other 999 lines. Something like diff -y --suppress-common-lines or diff -C 0 (zero lines of context).

And I'd really like to be able to toggle such a feature.

  • Would automatically displaying the first diff be a useful compromise? – cristobalito Dec 30 '14 at 12:38
  • Another way of phrasing this is that you want to fold all unchanged lines (code folding based on diff highlighting). However, I've only found ways to fold based on syntax in emacs. – idbrii May 13 '15 at 13:13
4

You can tweak the options used by Ediff by customizing ediff-diff-options, but options controlling the display (like context) are not supported.

You can however call ediff-show-diff-output from an ediff session (bound to D). This command will create a new buffer containing the 'raw' diff output. This command can have its own set of options, e.g.

(setq ediff-custom-diff-options "--suppress-common-lines")

This is not an ideal solution as the resulting buffer is not interactive in any way -- it just shows the diff command output.

2

I don't think Ediff is the right tool here. As I understand it, it's purpose is exactly to show you the difference with all the context (all while make it easy to move between different parts that have changed). You might want to use regular diff-mode instead (e.g. using the diff Emacs command).

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.