changeset 68225:adf40b463f96

(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.
author Juri Linkov <juri@jurta.org>
date Tue, 17 Jan 2006 01:41:52 +0000
parents e0ed492c53d1
children 8cac036adedc
files lisp/dired-aux.el
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/dired-aux.el	Tue Jan 17 00:57:41 2006 +0000
+++ b/lisp/dired-aux.el	Tue Jan 17 01:41:52 2006 +0000
@@ -53,14 +53,20 @@
 \\[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 ")")
 				     ""))