aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMountain Man <43313373+MountainMan1312@users.noreply.github.com>2023-05-30 20:01:34 -0400
committerMountain Man <43313373+MountainMan1312@users.noreply.github.com>2023-05-30 20:01:34 -0400
commitf43fbf5c39982c21e552bfa96fe14aa4b814cc20 (patch)
tree09f1b416ef0c0336631b26eea6c1500cf2e593cb
parentImprove default `isearch` functionality (diff)
downloadmmosmacs-f43fbf5c39982c21e552bfa96fe14aa4b814cc20.tar.gz
mmosmacs-f43fbf5c39982c21e552bfa96fe14aa4b814cc20.tar.bz2
mmosmacs-f43fbf5c39982c21e552bfa96fe14aa4b814cc20.zip
Add function to kill buffer after deleting file
-rw-r--r--init.el24
1 files changed, 24 insertions, 0 deletions
diff --git a/init.el b/init.el
index af221ef..b9a5528 100644
--- a/init.el
+++ b/init.el
@@ -571,6 +571,30 @@
571 571
572 572
573;; --------------------------------- 573;; ---------------------------------
574;; Delete files
575;; ------------
576;; Make deleting files a lot more
577;; convenient.
578;; ---------------------------------
579
580;; It's possible to delete a file
581;; and forget about it, then save
582;; buffer again. This function kills
583;; the buffer after deleting the
584;; file.
585(defun mm/delete-visited-file (buffer-name)
586 "Delete the file visited by BUFFER-NAME."
587 (interactive "bDelete file visited by buffer ")
588 (let* ((buffer (get-buffer buffer-name))
589 (filename (buffer-file-name buffer)))
590 (when buffer
591 (when (and filename
592 (file-exists-p filename))
593 (delete-file filename))
594 (kill-buffer buffer))))
595
596
597;; ---------------------------------
574;; Project management 598;; Project management
575;; ------------------ 599;; ------------------
576;; `Projectile' provides features 600;; `Projectile' provides features