summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJuri Linkov <juri@jurta.org>2006-01-17 01:43:00 +0000
committerJuri Linkov <juri@jurta.org>2006-01-17 01:43:00 +0000
commit84bf6ad84efc1975c45540c203480811dcbb7b26 (patch)
tree67dff7cb5dfa4a092a6684d3316ec65122821bf8 /lisp
parent202e166deac34b7b3c20b26ce0b67a0bdaddb62e (diff)
downloademacs-84bf6ad84efc1975c45540c203480811dcbb7b26.tar.gz
(dired-diff): Use dired-dwim-target-directory
instead of the file at the mark as default if the file at the mark is the same as the file at point or if dired-dwim-target-directory is not the same as the current directory and the mark is not active.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/dired-aux.el12
2 files changed, 14 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 63378f163f6..5c286c57b8f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
2006-01-17 Juri Linkov <juri@jurta.org>
+ * dired-aux.el (dired-diff): Use dired-dwim-target-directory
+ instead of the file at the mark as default if the file at the mark
+ is the same as the file at point or if dired-dwim-target-directory
+ is not the same as the current directory and the mark is not active.
+
* log-view.el (log-view-minor-wrap): Use the same logic to get
revisions as `log-view-diff'.
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index f946199bbd6..7a34c39bed5 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -53,14 +53,20 @@ FILE defaults to the file at the mark. (That's the mark set by
\\[set-mark-command], not by Dired's \\[dired-mark] command.)
The prompted-for file is the first file given to `diff'.
With prefix arg, prompt for second argument SWITCHES,
- which is options for `diff'."
+which is options for `diff'."
(interactive
- (let ((default (if (mark t)
+ (let ((current (dired-get-filename t))
+ (default (if (mark t)
(save-excursion (goto-char (mark t))
(dired-get-filename t t)))))
+ (if (or (equal default current)
+ (and (not (equal (dired-dwim-target-directory)
+ (dired-current-directory)))
+ (not mark-active)))
+ (setq default nil))
(require 'diff)
(list (read-file-name (format "Diff %s with%s: "
- (dired-get-filename t)
+ current
(if default
(concat " (default " default ")")
""))