emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: Mark in dired-diff


From: Juri Linkov
Subject: Re: Mark in dired-diff
Date: Thu, 08 Dec 2005 09:47:44 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

>> Perhaps it should ignore the mark when the mark is on the current
>> line--to make it similar to the other case we were just discussing.
>
> I think this is a good thing to do for non-transient mark mode.
>
> So to ignore the existing mark and to use the directory in the next window
> (if dired-dwim-target=t) there will be different methods:
>
> - in non-transient mark mode: set the mark on the current line;
>
> - in transient mark mode: deactivate the mark.

I believe the following patch DTRT for all possible cases.

Index: lisp/dired-aux.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/dired-aux.el,v
retrieving revision 1.141
diff -c -r1.141 dired-aux.el
*** lisp/dired-aux.el   24 Sep 2005 23:26:28 -0000      1.141
--- lisp/dired-aux.el   8 Dec 2005 07:47:29 -0000
***************
*** 55,66 ****
  With prefix arg, prompt for second argument SWITCHES,
   which is options for `diff'."
    (interactive
!    (let ((default (if (mark t)
                      (save-excursion (goto-char (mark t))
                                      (dired-get-filename t t)))))
       (require 'diff)
       (list (read-file-name (format "Diff %s with%s: "
!                                  (dired-get-filename t)
                                   (if default
                                       (concat " (default " default ")")
                                     ""))
--- 55,72 ----
  With prefix arg, prompt for second argument SWITCHES,
   which is options for `diff'."
    (interactive
!    (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: "
!                                  current
                                   (if default
                                       (concat " (default " default ")")
                                     ""))

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

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