all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Richard Stallman <rms@gnu.org>
Cc: 13772@debbugs.gnu.org
Subject: bug#13772: 24.3.50; dired-diff does not replace dired-backup-diff
Date: Thu, 28 Feb 2013 01:57:50 +0200	[thread overview]
Message-ID: <87k3pts3ro.fsf@mail.jurta.org> (raw)
In-Reply-To: <E1U8HKS-00048P-FY@fencepost.gnu.org> (Richard Stallman's message of "Wed, 20 Feb 2013 16:35:52 -0500")

> The M-= binding for dired-backup-diff was deleted,
> supposedly because dired-diff now replaces it.
> However, it does not.  If you type it on a backup file,
> it does not present the current file as the default argument.
> The default argument gives an error.
>
> And if you specify the current file as the argument, you get a diff
> between the right two files, but it is in reverse order.

The following patch copies the relevant logic from `diff-backup'
to `dired-diff', so that typing it on a backup file should present
its original as the default argument and run a diff in correct order.

=== modified file 'lisp/dired-aux.el'
*** lisp/dired-aux.el	2013-01-01 09:11:05 +0000
--- lisp/dired-aux.el	2013-02-27 23:56:03 +0000
*************** (defconst dired-quark-subst-regexp "\\(^
*** 55,61 ****
  (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.  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.)
--- 55,62 ----
  (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.  If the file at point
! is a backup file, use its original.  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.)
*************** (defun dired-diff (file &optional switch
*** 67,74 ****
  the string of command switches for the third argument of `diff'."
    (interactive
     (let* ((current (dired-get-filename t))
! 	  ;; 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))
--- 68,77 ----
  the string of command switches for the third argument of `diff'."
    (interactive
     (let* ((current (dired-get-filename t))
! 	  ;; Get the latest existing backup file or its original.
! 	  (oldf (if (backup-file-name-p current)
! 		    (file-name-sans-versions current)
! 		  (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))
*************** (defun dired-diff (file &optional switch
*** 107,113 ****
  		   (equal (expand-file-name current file)
  			  (expand-file-name current))))
        (error "Attempt to compare the file to itself"))
!     (diff file current switches)))
  
  ;;;###autoload
  (defun dired-backup-diff (&optional switches)
--- 110,119 ----
  		   (equal (expand-file-name current file)
  			  (expand-file-name current))))
        (error "Attempt to compare the file to itself"))
!     (if (and (backup-file-name-p current)
! 	     (not (backup-file-name-p file)))
! 	(diff current file switches)
!       (diff file current switches))))
  
  ;;;###autoload
  (defun dired-backup-diff (&optional switches)





      reply	other threads:[~2013-02-27 23:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-20 21:35 bug#13772: 24.3.50; dired-diff does not replace dired-backup-diff Richard Stallman
2013-02-27 23:57 ` Juri Linkov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k3pts3ro.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=13772@debbugs.gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.