hasu / notdeft

NotDeft note manager for Emacs
https://tero.hasu.is/notdeft/
170 stars 14 forks source link

`C-c C-d` notdeft-delete-file to a recycle bin #17

Closed icaruszhu closed 3 years ago

icaruszhu commented 3 years ago

Dear Tero,

First, thank you so much for the wonderful package, which I have been using for over half a year now. NotDeft is very fast and reliable, and I am so happy to chance upon it! :smile: (https://icaruszhu.github.io/chen/2020/09/20/To-Deft-or-NotDeft/)

However, very recently, I deleted a deft note (usingC-c C-d) by mistake. To my dismay, I could not retrieve it from the recycle bin. (BTW,I am using Ubuntu Studio 20.04 XFCE, and the recycle bin is called "Wastebasket") .

I looked at the elisp source file notdeft.el and found the function notdeft-delete-file used (delete-file old-file) without an optional TRASH argument. So I simply add t, which will move the deleted note to a recycle bin.

        (delete-file old-file t)

Would you consider this pull request? I guess this tiny change might be useful for other NotDeft users (just in case they delete a file by mistake). Thank you again!

==== p.s. I also have (setq delete-by-moving-to-trash t) in my init.el.

hasu commented 3 years ago

Heh, "To Deft or NotDeft."

I didn't even know that Emacs had some support for using the system recycle bin. Thank you for pointing that out.

I wouldn't want files ending up in the bin by default, unexpectedly, but I see that there's already an option for controlling that with delete-by-moving-to-trash', which you mention. Apparently other interactive commands (e.g.,delete-file' and Dired ones) also honor that option, so you're right in that it probably also makes sense for `notdeft-delete-file' to do that.

I've merged your change.

icaruszhu commented 3 years ago

Very many thanks, Tero!