all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Jorge Peixoto de Morais Neto <jorge13515@gmail.com>
Cc: 24089@debbugs.gnu.org
Subject: bug#24089: 25.1; Dired: diff error on = <RET> if the file has a backup inside .~/
Date: Thu, 28 Jul 2016 18:05:12 +0300	[thread overview]
Message-ID: <83popxrefr.fsf@gnu.org> (raw)
In-Reply-To: <1469644946.16323.9.camel@gmail.com> (message from Jorge Peixoto de Morais Neto on Wed, 27 Jul 2016 15:42:26 -0300)

> From: Jorge Peixoto de Morais Neto <jorge13515@gmail.com>
> Date: Wed, 27 Jul 2016 15:42:26 -0300
> 
> Please extract the attached gzipped tarball into ~.
> 
> Inside ~, start Emacs with an init file containing the following:
> --8<---------------cut here---------------start------------->8---
> (custom-set-variables
>  ;; custom-set-variables was added by Custom.
>  ;; If you edit it by hand, you could mess it up, so be careful.
>  ;; Your init file should contain only one such instance.
>  ;; If there is more than one, they won't work right.
>  '(backup-directory-alist (quote (("." . ".~"))))
> )
> 
> (custom-set-faces
>  ;; custom-set-faces was added by Custom.
>  ;; If you edit it by hand, you could mess it up, so be careful.
>  ;; Your init file should contain only one such instance.
>  ;; If there is more than one, they won't work right.
>  )
> --8<---------------cut here---------------end--------------->8---
> 
> Perform the following steps:
> 1. C-x d ~/dired-diff-bug-1 <RET>
> 2. j dummy <RET>
> 3. = <RET>
> I expected (according to the documentation of dired-diff) to see the
> diff of dummy with its backup.  Instead a diff error occurs.  I have
> saved the diff error buffer to diff-error-dummy.txt and attached it.
> 
> Now perform the following steps:
> 1. C-x d ~/dired-diff-bug-1/.~ <RET>
> 2. j dummy~ <RET>
> 3. = <RET>.
> A similar diff error occurs. It is also unexpected.  I have saved the
> diff error buffer in diff-error-dummy~.txt and attached it.

Thanks.

It seems dired-diff was not prepared to deal with the situation where
the backup file is in another directory.  Does the patch below produce
good results?

--- lisp/dired-aux.el~0	2016-05-08 07:05:52.000000000 +0300
+++ lisp/dired-aux.el	2016-07-28 18:01:02.437091400 +0300
@@ -78,8 +78,14 @@
 	  (file-at-mark (if (and transient-mark-mode mark-active)
 			    (save-excursion (goto-char (mark t))
 					    (dired-get-filename t t))))
+          (separate-dir (and oldf
+                             (not (equal (file-name-directory oldf)
+                                         (dired-current-directory)))))
 	  (default-file (or file-at-mark
-			    (and oldf (file-name-nondirectory oldf))))
+			    (and oldf
+                                 (if separate-dir
+                                     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))
@@ -88,7 +94,9 @@
 				default-file))
 		       default-file))
 	  (target-dir (if default
-			  (dired-current-directory)
+                          (if separate-dir
+                              (file-name-directory default)
+                            (dired-current-directory))
 			(dired-dwim-target-directory)))
 	  (defaults (dired-dwim-target-defaults (list current) target-dir)))
      (list





  reply	other threads:[~2016-07-28 15:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-27 18:42 bug#24089: 25.1; Dired: diff error on = <RET> if the file has a backup inside .~/ Jorge Peixoto de Morais Neto
2016-07-28 15:05 ` Eli Zaretskii [this message]
2016-07-29 11:43   ` Jorge Peixoto de Morais Neto
2016-07-29 14:43     ` Eli Zaretskii
2016-07-29 16:29       ` Jorge Peixoto de Morais Neto
2016-07-31 15:08         ` Eli Zaretskii
2016-08-03  2:04           ` Jorge Peixoto de Morais Neto
2016-08-06 10:18             ` Eli Zaretskii
2016-08-06 15:50               ` Jorge Peixoto de Morais Neto
2016-11-15 16:14               ` Jorge Morais Neto
2017-03-05 22:29                 ` Jorge Morais Neto
2017-03-06  3:33                   ` Eli Zaretskii
2020-08-24 17:17                 ` Lars Ingebrigtsen
2020-08-24 17:31                   ` Drew Adams

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=83popxrefr.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=24089@debbugs.gnu.org \
    --cc=jorge13515@gmail.com \
    /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.