reddit / emacs

Please explain to me what I see in ediff

JohnDoe365 · 2022-04-13 18:52
I compare two .emacs files - one is from my work computer, the other from my personal computer. Changes in these two files are quite evenly distributed. When I compare these two files with ediff, a first `n` completely highlights both files, one mostly in orange, the other one mostly in green. I guess that's because the diffing algorithm considers it to be one hunk? I see the details in words / lines by a visual difference in color. A second `n` unhighlights and a third `n` tells me there is no further difference list. Now this behavior is not very helpful. However, if I press `!` I see all changes in detail and can easily navigate with `n`, `p` and copy changes `a`, `b` between the two files. One file uses cr/lf line endings (coming from Windows), the other only lf (Linux) Is it normal to press `!` after an ediff session start? Is the initial all is different because of different newline encoding? How to ignore different newlines on first place?
lebensterben · 2022-04-13 19:06
what is ! bound to? and you can ignore whitespaces-only difference in ediff.
wargxs · 2022-04-13 21:40
! should be rerun the diffing
lebensterben · 2022-04-13 22:12
yes that's what I'm thinking. it updates the diff region, but then that doesn't sound like what OP describes.
7890yuiop · 2022-04-13 22:54
> Is the initial all is different because of different newline encoding? Unquestionably. That's causing every single line to be different, so that would all be a single hunk in the diff if EOL differences are not being ignored. > Is it normal to press ! after an ediff session start? I can replicate what you're seeing in 27.2 and 28.1, so in this scenario I guess it's "normal". I didn't find a description of this in the docs, so I can't tell whether it's intentional (perhaps for performance in large buffers) or a bug.
cmcmahan61 · 2022-04-14 20:31
Any time you're wondering what a key is bound to, type <ctrl>-h k (help, key). This will tell you what the key binding is. In this case (I'm not in front of emacs right now), I believe it means to refine the differences. The behavior you're seeing is what you guessed. The initial large block is caused by the line endings, and after refining, you see the other changes. I believe you can toggle whether or not line endings are used. From within ediff, type a question mark (?) to see the available options.
lebensterben · 2022-04-14 20:39
I'm not wondering what the keys are bound to for me. I want to know what they bind to in OP's ediff.