Don't bind M-= in Dired.

* lisp/dired.el (dired-mode-map): Don't bind M-=.

* lisp/dired-aux.el (dired-diff): Use backup file as default.
This commit is contained in:
Chong Yidong 2012-09-08 22:48:26 +08:00
parent 1715f2dbca
commit 35d98877f0
4 changed files with 38 additions and 38 deletions

View file

@ -423,6 +423,13 @@ channel keys found, if any.
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

View file

@ -1,3 +1,9 @@
2012-09-08 Chong Yidong <cyd@gnu.org>
* dired.el (dired-mode-map): Don't bind M-=.
* dired-aux.el (dired-diff): Use backup file as default.
2012-09-08 Drew Adams <drew.adams@oracle.com>
* subr.el (add-to-history): Fix delete usage (Bug#12314).

View file

@ -54,43 +54,30 @@ into this list; they also should call `dired-log' to log the errors.")
;;;###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))

View file

@ -1410,7 +1410,6 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
(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)
@ -3745,14 +3744,15 @@ 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" "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'.