Subject: Re: bug#58721: 28.2; dired with delete-by-moving-to-trash can't trash directory twice

From: Gustavo Barros <[email-masked]>
Date: Thu, 27 Oct 2022 14:07:21 -0300

Hi Eli,

On Thu, 27 Oct 2022 at 13:09, Eli Zaretskii <[email-masked]> wrote:

Thanks for looking into this.

> Could you please set debug-on-error t, repeat the experiment, and post
> the Lisp backtrace from the error?

I take this means you can't reproduce? Anyway, of course I can send
the backtrace.

For some reason I don't understand, even though I get the message as
described in the original recipe, it did not generate a backtrace
(some error control somewhere?).

I could generate a backtrace with:

    (setq debug-on-error t)
    (setq delete-by-moving-to-trash t)
    (move-file-to-trash "/path/to/org-mode")

And it is (slightly edited, since it contained more info than I'd like
to share):

Debugger entered--Lisp error: (file-already-exists "File exists"
"/home/<username>/.local/share/Trash/files/org-mode83g...")
  make-directory-internal("/home/<username>/.local/share/Trash/files/org-mode83g...")
  make-directory("/home/<username>/.local/share/Trash/files/org-mode83g..." nil)
  copy-directory("/home/<username>/path/to/file/org-mode"
"/home/<username>/.local/share/Trash/files/org-mode83g..." t nil)
  rename-file("/home/<username>/path/to/file/org-mode"
"/home/<username>/.local/share/Trash/files/org-mode83g..." t)
  move-file-to-trash("/home/<username>/path/to/file/org-mode")
  (progn (move-file-to-trash "/home/<username>/path/to/file/org-mode"))
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  command-execute(eval-last-sexp)

Best regards,
Gustavo.