summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuri Linkov <juri@jurta.org>2013-02-28 23:51:11 +0200
committerJuri Linkov <juri@jurta.org>2013-02-28 23:51:11 +0200
commit9d232fc451d9abc3e3ee3eead61176067470b24e (patch)
tree062a0376da0e020289cd60bc86411589c9837c86
parent779451da533b042d2c84132e6157f49b38ede475 (diff)
downloademacs-9d232fc451d9abc3e3ee3eead61176067470b24e.tar.gz
* lisp/dired-aux.el (dired-diff): If file at point is a backup file,
use its original as the default value, and reverse the order of arguments to the `diff' call. Doc fix. Fixes: debbugs:13772
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/dired-aux.el14
-rw-r--r--lisp/dired.el5
3 files changed, 19 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9721dba6b0f..44109a5095f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2013-02-28 Juri Linkov <juri@jurta.org>
+
+ * dired-aux.el (dired-diff): If file at point is a backup file,
+ use its original as the default value, and reverse the order
+ of arguments to the `diff' call. Doc fix. (Bug#13772)
+
2013-02-28 Michael Albinus <michael.albinus@gmx.de>
* net/tramp-adb.el (tramp-adb-sdk-dir): Remove. Replaced by ...
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 13443419bd7..f6ff32b0b01 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -55,7 +55,8 @@ into this list; they also should call `dired-log' to log the errors.")
(defun 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 mark is active
+has a backup file, use that as the default. If the file at point
+is a backup file, use its original. If the mark is active
in Transient Mark mode, use the file at the mark as the default.
\(That's the mark set by \\[set-mark-command], not by Dired's
\\[dired-mark] command.)
@@ -67,8 +68,10 @@ With prefix arg, prompt for second argument SWITCHES, which is
the string of command switches for the third argument of `diff'."
(interactive
(let* ((current (dired-get-filename t))
- ;; Get the latest existing backup file.
- (oldf (diff-latest-backup-file current))
+ ;; Get the latest existing backup file or its original.
+ (oldf (if (backup-file-name-p current)
+ (file-name-sans-versions current)
+ (diff-latest-backup-file current)))
;; Get the file at the mark.
(file-at-mark (if (and transient-mark-mode mark-active)
(save-excursion (goto-char (mark t))
@@ -107,7 +110,10 @@ the string of command switches for the third argument of `diff'."
(equal (expand-file-name current file)
(expand-file-name current))))
(error "Attempt to compare the file to itself"))
- (diff file current switches)))
+ (if (and (backup-file-name-p current)
+ (equal file (file-name-sans-versions current)))
+ (diff current file switches)
+ (diff file current switches))))
;;;###autoload
(defun dired-backup-diff (&optional switches)
diff --git a/lisp/dired.el b/lisp/dired.el
index 28045043c82..f03e0aca475 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -3864,13 +3864,14 @@ Ask means pop up a menu for the user to select one of copy, move or link."
;;;;;; dired-run-shell-command dired-do-shell-command dired-do-async-shell-command
;;;;;; dired-clean-directory dired-do-print dired-do-touch dired-do-chown
;;;;;; dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff
-;;;;;; dired-diff) "dired-aux" "dired-aux.el" "066bb17769887a7fbc0490003f59e4b3")
+;;;;;; dired-diff) "dired-aux" "dired-aux.el" "d6a694b6d13fa948465fde52a9ffb3ba")
;;; Generated autoloads from dired-aux.el
(autoload 'dired-diff "dired-aux" "\
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 mark is active
+has a backup file, use that as the default. If the file at point
+is a backup file, use its original. If the mark is active
in Transient Mark mode, use the file at the mark as the default.
\(That's the mark set by \\[set-mark-command], not by Dired's
\\[dired-mark] command.)