summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/init-buffile.el10
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