delete-by-moving-to-trash is a variable defined in ‘src/fileio.c’.
Its value is nil
Specifies whether to use the system’s trash can. When non-nil, certain file deletion commands use the function ‘move-file-to-trash’ instead of deleting files outright. This includes interactive calls to ‘delete-file’ and ‘delete-directory’ and the Dired deletion commands.
This variable was introduced, or its default value was changed, in
version 23.1 of Emacs.
You can customize this variable.
---If this option doesn't work for you, you should report a bug.