if the command ends in `;' (when operating on multiple files).
Otherwise, it executes the command on each file in parallel.
+*** The minibuffer default for `=' (`dired-diff) has changed.
+It is now the backup file for the file at point, if one exists, rather
+than the file at the mark.
+
+*** `M-=' is no longer bound to `dired-backup-diff' in Dired buffers.
+The global binding for `M-=', `count-words-region' is in effect.
+
** Shell
*** New option `async-shell-command-buffer' specifies what buffer to use
;;;###autoload
(defun dired-diff (file &optional switches)
"Compare file at point with file FILE using `diff'.
-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'.
+If called interactively, prompt for FILE; if the file at point
+has a backup file, use that as the default.
+
+FILE is the first file given to `diff'.
With prefix arg, prompt for second argument SWITCHES,
which is the string of command switches for `diff'."
(interactive
(let* ((current (dired-get-filename t))
- ;; Get the file at the mark.
- (file-at-mark (if (mark t)
- (save-excursion (goto-char (mark t))
- (dired-get-filename t t))))
- ;; Use it as default if it's not the same as the current file,
- ;; and the target dir is the current dir or the mark is active.
- (default (if (and (not (equal file-at-mark current))
- (or (equal (dired-dwim-target-directory)
- (dired-current-directory))
- mark-active))
- file-at-mark))
- (target-dir (if default
- (dired-current-directory)
- (dired-dwim-target-directory)))
- (defaults (dired-dwim-target-defaults (list current) target-dir)))
- (require 'diff)
- (list
- (minibuffer-with-setup-hook
- (lambda ()
- (set (make-local-variable 'minibuffer-default-add-function) nil)
- (setq minibuffer-default defaults))
- (read-file-name
- (format "Diff %s with%s: " current
- (if default (format " (default %s)" default) ""))
- target-dir default t))
- (if current-prefix-arg
- (read-string "Options for diff: "
- (if (stringp diff-switches)
- diff-switches
- (mapconcat 'identity diff-switches " ")))))))
+ (oldf (file-newest-backup current))
+ (dir (if oldf (file-name-directory oldf))))
+ (list (read-file-name
+ (format "Diff %s with%s: "
+ (file-name-nondirectory current)
+ (if oldf
+ (concat " (default "
+ (file-name-nondirectory oldf)
+ ")")
+ ""))
+ dir oldf t)
+ (if current-prefix-arg
+ (read-string "Options for diff: "
+ (if (stringp diff-switches)
+ diff-switches
+ (mapconcat 'identity diff-switches " ")))))))
(let ((current (dired-get-filename t)))
(when (or (equal (expand-file-name file)
(expand-file-name current))
(define-key map "&" 'dired-do-async-shell-command)
;; Comparison commands
(define-key map "=" 'dired-diff)
- (define-key map "\M-=" 'dired-backup-diff)
;; Tree Dired commands
(define-key map "\M-\C-?" 'dired-unmark-all-files)
(define-key map "\M-\C-d" 'dired-tree-down)
;;;;;; 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" "9499f79f5853da0aa93d26465c7bf3a1")
+;;;;;; dired-diff) "dired-aux" "dired-aux.el" "4b260eda371d319a6c8e8e5ec917e287")
;;; Generated autoloads from dired-aux.el
(autoload 'dired-diff "dired-aux" "\
Compare file at point with file FILE using `diff'.
-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'.
+If called interactively, prompt for FILE; if the file at point
+has a backup file, use that as the default.
+
+FILE is the first file given to `diff'.
With prefix arg, prompt for second argument SWITCHES,
which is the string of command switches for `diff'.