Putting to Trash

I was recently reading a post about deleting files from within emacs and pushing them to the local Trash, this seems like a good idea especially now I am using dired more often.

After using describe-function and typing trash there was a single completion, namely move-file-to-trash from this I figured out I should add the following my .emacs:

(setq trash-directory "~/.local/share/Trash/files")
(setq delete-by-moving-to-trash t)

I am running this on OpenSuse so the location of the Trash folder may vary from system to system.

For a more bespoke copying mechanism there is potentially the ability to define system-move-file-to-trash accepting file as an argument, but currently I don’t need anything to be that sophisticated.

Comments

comments powered by Disqus