Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get ediff mode to stop highlighting lines that differ only by whitespace?

I have two similar functions in C++ that I want to carefully compare. I'm using the emacs function ediff-regions-linewise to compare them line-by-line. Many of the lines have small differences in their whitespace, for example:

//Line from first function
somefunc(i,j);
//Line from second function
somefunc(i, j);

Ediff-mode is smart enough to know which sections only differ by whitespace: the command ## nominally means "ignore whitespace". It only causes the cursor to skip sections that differ, but still highlights lines that differ only by whitespace in the same way it highlights lines that differ in some way that matters.

Is there a way to get ediff-mode to stop highlighting lines that are only different because of whitespace?

like image 576
Dan Avatar asked Nov 20 '12 00:11

Dan


2 Answers

I have got the following setting in my Emacs config to disable whitespace when diffing (see man diff for what it does):

(setq ediff-diff-options "-w")
like image 140
aerique Avatar answered Oct 02 '22 04:10

aerique


I have these two settings which have the net effect of doing what you're asking:

(setq-default ediff-ignore-similar-regions t)
(setq-default ediff-highlight-all-diffs nil)
like image 45
Trey Jackson Avatar answered Oct 02 '22 04:10

Trey Jackson