Subject: bug#24474: dired-diff doesn't know about backup-directory-alist

From: 積丹尼 Dan Jacobson <[email-masked]>
Date: Mon, 19 Sep 2016 23:40:37 +0800

= runs the command dired-diff, which is an interactive autoloaded
compiled Lisp function in `dired-aux.el'.

It is bound to =, <menu-bar> <immediate> <diff>.

(dired-diff FILE &optional SWITCHES)

Compare file at point with file FILE using `diff'.
If called interactively, prompt for FILE.  If the file at point
has a backup file, use that as the default.  If the file at point
is a backup file, use its original...

[OK, let's try it. Oops:]

diff -U0 /home/jidanni/\!home\!jidanni\!.bash_profile.\~42\~ /home/jidanni/.bash_profile
diff: /home/jidanni/!home!jidanni!.bash_profile.~42~: No such file or directory

Diff finished (diff error).  Mon Sep 19 23:25:22 2016

[Which is because the correct file name is:]

/home/jidanni/.backups/!home!jidanni!.bash_profile.~42~

[because of my:]

backup-directory-alist is a variable defined in `files.el'.
Its value is ((".*" . "~/.backups/"))
Original value was nil

[So we see that dired-diff got the filename right, but the directory
wrong.

Furthermore, "if the file at point is a backup file..." also fails
miserably. Go to your ~/.backups directory and try it on a few files...]

diff -U0 /home/jidanni/.backups/\!home\!jidanni\!.bash_profile.\~42\~ /home/jidanni/.backups/\!home\!jidanni\!.bash_profile
diff: /home/jidanni/.backups/!home!jidanni!.bash_profile: No such file or directory

Diff finished (diff error).  Mon Sep 19 23:37:10 2016

[We see it assumes everything is in the same directory.
It should have tried comparing ~/.bash_profile .

emacs-version "24.5.1".]