emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp ChangeLog dired-aux.el


From: Juri Linkov
Subject: [Emacs-diffs] emacs/lisp ChangeLog dired-aux.el
Date: Wed, 16 Dec 2009 09:52:47 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Juri Linkov <jurta>     09/12/16 09:52:47

Modified files:
        lisp           : ChangeLog dired-aux.el 

Log message:
        Revert to old 23.1 logic of using the file at the mark as default.
        * dired-aux.el (dired-diff): Use the file at the mark 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.  Add the current file
        as the arg of `dired-dwim-target-defaults'.  Use the default file
        in the prompt.  (Bug#5225)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16908&r2=1.16909
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/dired-aux.el?cvsroot=emacs&r1=1.199&r2=1.200

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16908
retrieving revision 1.16909
diff -u -b -r1.16908 -r1.16909
--- ChangeLog   15 Dec 2009 21:11:39 -0000      1.16908
+++ ChangeLog   16 Dec 2009 09:52:42 -0000      1.16909
@@ -1,3 +1,12 @@
+2009-12-16  Juri Linkov  <address@hidden>
+
+       Revert to old 23.1 logic of using the file at the mark as default.
+       * dired-aux.el (dired-diff): Use the file at the mark 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.  Add the current file
+       as the arg of `dired-dwim-target-defaults'.  Use the default file
+       in the prompt.  (Bug#5225)
+
 2009-12-15  Michael Albinus  <address@hidden>
 
        * net/tramp.el (tramp-echo-mark-marker-length): New defconst.

Index: dired-aux.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/dired-aux.el,v
retrieving revision 1.199
retrieving revision 1.200
diff -u -b -r1.199 -r1.200
--- dired-aux.el        25 Nov 2009 17:15:24 -0000      1.199
+++ dired-aux.el        16 Dec 2009 09:52:47 -0000      1.200
@@ -60,21 +60,31 @@
 which is options for `diff'."
   (interactive
    (let* ((current (dired-get-filename t))
-         (target-dir (dired-dwim-target-directory))
-         (marked (and (mark t) (save-excursion
-                                 (goto-char (mark t))
-                                 (dired-get-filename nil t))))
-         (defaults
-           (append (dired-dwim-target-defaults nil target-dir)
-                   ;; Additional file with the mark.
-                   (and marked (list marked)))))
+         ;; 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: " current) target-dir nil t))
+       (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)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]