How can I get ediff mode to stop the selection of lines that differ only in spaces?

I have two similar functions in C ++ that I want to compare carefully. I use the emacs ediff-regions-linewise to compare them one at a time. Many of the lines have slight differences in their space, 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 differ only in spaces: the ## command nominally means "ignore spaces". This causes the cursor to skip sections that differ from each other, but still highlight lines that differ only in spaces, just as they highlight lines that have some meaning.

Is there a way to force ediff-mode to stop highlighting lines that differ from each other just because of spaces?

+4
source share
3 answers

I have the following setting in my Emacs configuration to disable space if it is different (see man diff , what it does):

 (setq ediff-diff-options "-w") 
+3
source

I have these two settings that have a pure effect on what you ask for:

 (setq-default ediff-ignore-similar-regions t) (setq-default ediff-highlight-all-diffs nil) 
+1
source

While (setq ediff-diff-options "-w") can hit the nail, it can hide the error on other days.

Menu

ediff suggests using # # to switch the difference in spaces.

With enabled move commands without spaces ( n / p ) skips hunks only with differences in spaces.

Emacs, by default, highlights non-whitespace differences across faces. But by default they have the same colors, not different from each other. To make them visible, use something like:

 (set-face-foreground 'diff-added-face "DarkGreen") (set-face-foreground 'diff-removed-face "DarkRed") (set-face-background 'diff-refine-change "LightBlue1") 

Also try executing the h command in the ediff control buffer.

This does not answer your direct question, but makes it pointless.

+1
source

Source: https://habr.com/ru/post/1447108/


All Articles