[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r110093: * lisp/dired-aux.el (dired-d
From: |
Juri Linkov |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r110093: * lisp/dired-aux.el (dired-diff): Restore original functionality of |
Date: |
Wed, 19 Sep 2012 02:40:39 +0300 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 110093
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Wed 2012-09-19 02:40:39 +0300
message:
* lisp/dired-aux.el (dired-diff): Restore original functionality of
getting the default value, but keep new feature of using the
latest existing backup file (`diff-latest-backup-file').
modified:
etc/NEWS
lisp/ChangeLog
lisp/dired-aux.el
lisp/dired.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS 2012-09-18 23:18:06 +0000
+++ b/etc/NEWS 2012-09-18 23:40:39 +0000
@@ -468,8 +468,8 @@
mark/unmark/flag all files in the active region.
*** 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.
+It is now the backup file for the file at point, if one exists.
+In Transient Mark mode the default is the file at the active mark.
*** `M-=' is no longer bound to `dired-backup-diff' in Dired buffers.
The global binding for `M-=', `count-words-region' is in effect.
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-09-18 23:18:06 +0000
+++ b/lisp/ChangeLog 2012-09-18 23:40:39 +0000
@@ -1,5 +1,11 @@
2012-09-18 Juri Linkov <address@hidden>
+ * dired-aux.el (dired-diff): Restore original functionality of
+ getting the default value, but keep new feature of using the
+ latest existing backup file (`diff-latest-backup-file').
+
+2012-09-18 Juri Linkov <address@hidden>
+
* dired.el (dired-mark): If the region is active in Transient Mark
mode, mark all files in the active region. Doc fix.
(dired-unmark, dired-flag-file-deletion, dired-unmark-backward):
=== modified file 'lisp/dired-aux.el'
--- a/lisp/dired-aux.el 2012-09-18 22:57:45 +0000
+++ b/lisp/dired-aux.el 2012-09-18 23:40:39 +0000
@@ -51,33 +51,57 @@
(defconst dired-star-subst-regexp "\\(^\\|[ \t]\\)\\*\\([ \t]\\|$\\)")
(defconst dired-quark-subst-regexp "\\(^\\|[ \t]\\)\\?\\([ \t]\\|$\\)")
+(declare-function diff-latest-backup-file "diff" (fn)) ; actually belongs into
files.el
+
;;;###autoload
(defun dired-diff (file &optional switches)
"Compare file at point with file FILE using `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'."
+If called interactively, prompt for FILE. If the file at point
+has a backup file, use that as the default. If the mark is active
+in Transient Mark mode, use the file at the mark as the default.
+\(That's the mark set by \\[set-mark-command], not by Dired's
+\\[dired-mark] command.)
+
+FILE is the first file given to `diff'. The file at point
+is the second file given to `diff'.
+
+With prefix arg, prompt for second argument SWITCHES, which is
+the string of command switches for the third argument of `diff'."
(interactive
(let* ((current (dired-get-filename t))
- (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 " ")))))))
+ ;; Get the latest existing backup file.
+ (oldf (diff-latest-backup-file current))
+ ;; Get the file at the mark.
+ (file-at-mark (if (and transient-mark-mode mark-active)
+ (save-excursion (goto-char (mark t))
+ (dired-get-filename t t))))
+ (default-file (or file-at-mark
+ (and oldf (file-name-nondirectory oldf))))
+ ;; Use it as default if it's not the same as the current file,
+ ;; and the target dir is current or there is a default file.
+ (default (if (and (not (equal default-file current))
+ (or (equal (dired-dwim-target-directory)
+ (dired-current-directory))
+ default-file))
+ default-file))
+ (target-dir (if default
+ (dired-current-directory)
+ (dired-dwim-target-directory)))
+ (defaults (dired-dwim-target-defaults (list current) target-dir)))
+ (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 " ")))))))
(let ((current (dired-get-filename t)))
(when (or (equal (expand-file-name file)
(expand-file-name current))
=== modified file 'lisp/dired.el'
--- a/lisp/dired.el 2012-09-18 23:18:06 +0000
+++ b/lisp/dired.el 2012-09-18 23:40:39 +0000
@@ -3763,17 +3763,22 @@
;;;;;; 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"
"3650b53533253c50b10e2aa8c9005ebf")
+;;;;;; dired-diff) "dired-aux" "dired-aux.el"
"2a883f0d481a8d0292eb90c09ae36a8e")
;;; Generated autoloads from dired-aux.el
(autoload 'dired-diff "dired-aux" "\
Compare file at point with file FILE using `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'.
+If called interactively, prompt for FILE. If the file at point
+has a backup file, use that as the default. If the mark is active
+in Transient Mark mode, use the file at the mark as the default.
+\(That's the mark set by \\[set-mark-command], not by Dired's
+\\[dired-mark] command.)
+
+FILE is the first file given to `diff'. The file at point
+is the second file given to `diff'.
+
+With prefix arg, prompt for second argument SWITCHES, which is
+the string of command switches for the third argument of `diff'.
\(fn FILE &optional SWITCHES)" t nil)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r110093: * lisp/dired-aux.el (dired-diff): Restore original functionality of,
Juri Linkov <=