backup-walker icon indicating copy to clipboard operation
backup-walker copied to clipboard

Why the diff order reverse?

Open snowman opened this issue 5 years ago • 0 comments

Description

By debug suffixes data of function backup-walker-refresh, its structure is (".~3~" ".~2~" ".~1~")

Every time you

  1. press "p" (prev changes) to increase(+) index pointer, like from ".~3~" to ".~2~" (for older changes)
  2. press "n" (next changes) to decrease(-) index pointer, like from ".~2~" to ".~3~" (for newer changes)

The first item ".~3~" is most recent, this is different from git notation like HEAD~3

So in your code, left-file with (setq left-file (concat prefix (nth (1- index) suffixes))) means more recent file, right-file means older file

But you passed them to function diff-no-select in reversed order

https://github.com/lewang/backup-walker/blob/934a4128c122972ac32bb9952addf279a60a94da/backup-walker.el#L269-L274


see? you write (diff old new switches no-async)

https://github.com/lewang/backup-walker/blob/934a4128c122972ac32bb9952addf279a60a94da/backup-walker.el#L120-L123


What you expect?

(setq diff-buf (diff-no-select left-file right-file nil 'noasync))

should be

(setq diff-buf (diff-no-select right-file left-file nil 'noasync))

snowman avatar Oct 03 '20 03:10 snowman