Created
July 21, 2015 11:55
-
-
Save hyOzd/23b87e96d43bca0f0b52 to your computer and use it in GitHub Desktop.
emacs delete current file and close the buffer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; based on http://emacsredux.com/blog/2013/04/03/delete-file-and-buffer/ | |
(defun delete-file-and-buffer () | |
"Kill the current buffer and deletes the file it is visiting." | |
(interactive) | |
(let ((filename (buffer-file-name))) | |
(if filename | |
(if (y-or-n-p (concat "Do you really want to delete file " filename " ?")) | |
(progn | |
(delete-file filename) | |
(message "Deleted file %s." filename) | |
(kill-buffer))) | |
(message "Not a file visiting buffer!")))) |
Thanks!
Thanks,It helps me cleaning up org-roam files easily.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you!