Emacs: delete the file corresponding to the current buffer.

A small function to delete the file corresponding to the buffer currently being accessed (put it in the recycle bin).

( defun  delete-this-file  () 
    "Delete (move to trash) the file that is associated with the 
   current buffer." 
     ( interactive ) 
     ( let  (( filename ( buffer-file- name ))) 
( delete-file filename t ) 7:   ( kill-buffer )))

After eval, according M-x delete-this-file to.

My site is free of ads and trackers. Was this post helpful to you? Why not BuyMeACoffee