Commit 9d232fc4 authored by Juri Linkov's avatar Juri Linkov
Browse files

* 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
parent 779451da
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 ...
......
......@@ -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)
......
......@@ -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.)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment