diff options
author | Kyle Meyer <kyle@kyleam.com> | 2014-01-26 02:23:00 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2014-01-26 02:23:00 -0500 |
commit | a4c54f239fce51ccdffd394cfab373a24dc4759f (patch) | |
tree | 786e860200b6af3725a29e37ab3748e9b5291468 | |
parent | 05282c043b0493fb69b0f9d5088c5030d3f1740e (diff) | |
download | emacs.d-a4c54f239fce51ccdffd394cfab373a24dc4759f.tar.gz |
Add function to delete current buffer's file
Taken from
https://github.com/purcell/emacs.d/blob/master/lisp/init-utils.el.
-rw-r--r-- | lisp/init-buffile.el | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/init-buffile.el b/lisp/init-buffile.el index 865e629..09da103 100644 --- a/lisp/init-buffile.el +++ b/lisp/init-buffile.el @@ -19,6 +19,16 @@ (global-set-key (kbd "C-x C-r") 'km/rename-current-buffer-file) +;; https://github.com/purcell/emacs.d/blob/master/lisp/init-utils.el +(defun km/delete-this-file () + "Delete the current file, and kill the buffer." + (interactive) + (or (buffer-file-name) (error "No file is currently being edited")) + (when (yes-or-no-p (format "Really delete '%s'?" + (file-name-nondirectory buffer-file-name))) + (delete-file (buffer-file-name)) + (kill-this-buffer))) + ;; http://emacs-fu.blogspot.com/2013/03/editing-with-root-privileges-once-more.html (defun km/find-file-as-root () "`ido-find-file` that automatically edits the file with |