diff options
author | Alan Pearce | 2024-05-13 21:50:56 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-13 21:53:43 +0200 |
commit | 558d23085fab11e8f49ae583c71f203279c4e8bc (patch) | |
tree | 068c0743cc46699161e0932f2de1e74ff9864f13 /user | |
parent | 9525dddaa025a9a779730f029fe39091804bbf83 (diff) | |
download | nixfiles-558d23085fab11e8f49ae583c71f203279c4e8bc.tar.lz nixfiles-558d23085fab11e8f49ae583c71f203279c4e8bc.tar.zst nixfiles-558d23085fab11e8f49ae583c71f203279c4e8bc.zip |
emacs: don't stop me deleting files which have changes in git
Diffstat (limited to 'user')
-rw-r--r-- | user/emacs/init.el | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el index 2f338b9a..117b2bda 100644 --- a/user/emacs/init.el +++ b/user/emacs/init.el @@ -632,6 +632,16 @@ _C-k_: prev _u_pper _=_: upper/lower _s_mart resolve (setq delete-by-moving-to-trash t) +(defun my/delete-file-and-buffer () + "Kill the current buffer and deletes the file it is visiting." + (interactive) + (let ((filename (buffer-file-name))) + (when filename + (when (y-or-n-p (format "Are you sure you want to delete %s? " filename)) + (delete-file filename delete-by-moving-to-trash) + (message "Deleted file %s" filename) + (kill-buffer))))) + (use-package goto-chg :defer 1) @@ -1143,7 +1153,7 @@ _C-k_: prev _u_pper _=_: upper/lower _s_mart resolve "fs" #'save-buffer "ff" #'find-file "fw" #'write-file - "fd" #'crux-delete-file-and-buffer + "fd" #'my/delete-file-and-buffer "fr" #'crux-rename-file-and-buffer "gs" #'magit-status "gm" #'vc-msg-show |