A little function that moves the file that is associated with the current buffer to the system’s trash bin.
1: (defun delete-this-file () 2: "Delete (move to trash) the file that is associated with the 3: current buffer." 4: (interactive) 5: (let ((filename (buffer-file-name))) 6: (delete-file filename t) 7: (kill-buffer)))
eval it and then you could press
M-x delete-this-file to trigger it.