When I try to trash a remote directory, either through dired or with delete-directory, Tramp just deletes it. If I try to trash a remote file, it does trash it properly.

I have delete-by-moving-to-trash set to t. If I call tramp-get-remote-trash for my remote host, it returns "\\trash".

I've been stepping through the calls, and it ends up calling tramp-sh-handle-delete-directory, which doesn't seem to have a trash option. I wonder if things aren't going wrong in delete-directory, where the cond clauses are ordered such that the file name handler is found and called without a trash argument before the clause which handles trashing a directory. But I might not yet understand this code properly.

Does anyone know how to get Tramp to trash a remote directory properly?

  • 2
    I would file a bug report: worst case you've missed some obscure setting in tramp, which may be a bug in itself.
    – wvxvw
    Commented May 3, 2017 at 3:29
  • 1
    @wvxvw OK, thanks. I just submitted a bug report. I'll create an answer here once it gets resolved. Commented May 3, 2017 at 18:08

1 Answer 1


Related Emacs bug 26763 has been fixed in the repository. Fix will appear with next Emacs 26.1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.