diff options
| author | Juri Linkov | 2013-02-28 23:51:11 +0200 |
|---|---|---|
| committer | Juri Linkov | 2013-02-28 23:51:11 +0200 |
| commit | 9d232fc451d9abc3e3ee3eead61176067470b24e (patch) | |
| tree | 062a0376da0e020289cd60bc86411589c9837c86 | |
| parent | 779451da533b042d2c84132e6157f49b38ede475 (diff) | |
| download | emacs-9d232fc451d9abc3e3ee3eead61176067470b24e.tar.gz emacs-9d232fc451d9abc3e3ee3eead61176067470b24e.zip | |
* 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/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/dired-aux.el | 14 | ||||
| -rw-r--r-- | lisp/dired.el | 5 |
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 @@ | |||
| 1 | 2013-02-28 Juri Linkov <juri@jurta.org> | ||
| 2 | |||
| 3 | * dired-aux.el (dired-diff): If file at point is a backup file, | ||
| 4 | use its original as the default value, and reverse the order | ||
| 5 | of arguments to the `diff' call. Doc fix. (Bug#13772) | ||
| 6 | |||
| 1 | 2013-02-28 Michael Albinus <michael.albinus@gmx.de> | 7 | 2013-02-28 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 8 | ||
| 3 | * net/tramp-adb.el (tramp-adb-sdk-dir): Remove. Replaced by ... | 9 | * 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.") | |||
| 55 | (defun dired-diff (file &optional switches) | 55 | (defun dired-diff (file &optional switches) |
| 56 | "Compare file at point with file FILE using `diff'. | 56 | "Compare file at point with file FILE using `diff'. |
| 57 | If called interactively, prompt for FILE. If the file at point | 57 | If called interactively, prompt for FILE. If the file at point |
| 58 | has a backup file, use that as the default. If the mark is active | 58 | has a backup file, use that as the default. If the file at point |
| 59 | is a backup file, use its original. If the mark is active | ||
| 59 | in Transient Mark mode, use the file at the mark as the default. | 60 | in Transient Mark mode, use the file at the mark as the default. |
| 60 | \(That's the mark set by \\[set-mark-command], not by Dired's | 61 | \(That's the mark set by \\[set-mark-command], not by Dired's |
| 61 | \\[dired-mark] command.) | 62 | \\[dired-mark] command.) |
| @@ -67,8 +68,10 @@ With prefix arg, prompt for second argument SWITCHES, which is | |||
| 67 | the string of command switches for the third argument of `diff'." | 68 | the string of command switches for the third argument of `diff'." |
| 68 | (interactive | 69 | (interactive |
| 69 | (let* ((current (dired-get-filename t)) | 70 | (let* ((current (dired-get-filename t)) |
| 70 | ;; Get the latest existing backup file. | 71 | ;; Get the latest existing backup file or its original. |
| 71 | (oldf (diff-latest-backup-file current)) | 72 | (oldf (if (backup-file-name-p current) |
| 73 | (file-name-sans-versions current) | ||
| 74 | (diff-latest-backup-file current))) | ||
| 72 | ;; Get the file at the mark. | 75 | ;; Get the file at the mark. |
| 73 | (file-at-mark (if (and transient-mark-mode mark-active) | 76 | (file-at-mark (if (and transient-mark-mode mark-active) |
| 74 | (save-excursion (goto-char (mark t)) | 77 | (save-excursion (goto-char (mark t)) |
| @@ -107,7 +110,10 @@ the string of command switches for the third argument of `diff'." | |||
| 107 | (equal (expand-file-name current file) | 110 | (equal (expand-file-name current file) |
| 108 | (expand-file-name current)))) | 111 | (expand-file-name current)))) |
| 109 | (error "Attempt to compare the file to itself")) | 112 | (error "Attempt to compare the file to itself")) |
| 110 | (diff file current switches))) | 113 | (if (and (backup-file-name-p current) |
| 114 | (equal file (file-name-sans-versions current))) | ||
| 115 | (diff current file switches) | ||
| 116 | (diff file current switches)))) | ||
| 111 | 117 | ||
| 112 | ;;;###autoload | 118 | ;;;###autoload |
| 113 | (defun dired-backup-diff (&optional switches) | 119 | (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." | |||
| 3864 | ;;;;;; dired-run-shell-command dired-do-shell-command dired-do-async-shell-command | 3864 | ;;;;;; dired-run-shell-command dired-do-shell-command dired-do-async-shell-command |
| 3865 | ;;;;;; dired-clean-directory dired-do-print dired-do-touch dired-do-chown | 3865 | ;;;;;; dired-clean-directory dired-do-print dired-do-touch dired-do-chown |
| 3866 | ;;;;;; dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff | 3866 | ;;;;;; dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff |
| 3867 | ;;;;;; dired-diff) "dired-aux" "dired-aux.el" "066bb17769887a7fbc0490003f59e4b3") | 3867 | ;;;;;; dired-diff) "dired-aux" "dired-aux.el" "d6a694b6d13fa948465fde52a9ffb3ba") |
| 3868 | ;;; Generated autoloads from dired-aux.el | 3868 | ;;; Generated autoloads from dired-aux.el |
| 3869 | 3869 | ||
| 3870 | (autoload 'dired-diff "dired-aux" "\ | 3870 | (autoload 'dired-diff "dired-aux" "\ |
| 3871 | Compare file at point with file FILE using `diff'. | 3871 | Compare file at point with file FILE using `diff'. |
| 3872 | If called interactively, prompt for FILE. If the file at point | 3872 | If called interactively, prompt for FILE. If the file at point |
| 3873 | has a backup file, use that as the default. If the mark is active | 3873 | has a backup file, use that as the default. If the file at point |
| 3874 | is a backup file, use its original. If the mark is active | ||
| 3874 | in Transient Mark mode, use the file at the mark as the default. | 3875 | in Transient Mark mode, use the file at the mark as the default. |
| 3875 | \(That's the mark set by \\[set-mark-command], not by Dired's | 3876 | \(That's the mark set by \\[set-mark-command], not by Dired's |
| 3876 | \\[dired-mark] command.) | 3877 | \\[dired-mark] command.) |