Fix delete-file implementation

This commit is contained in:
Jeremy Dormitzer 2024-06-18 12:35:05 -04:00
parent 68955452a5
commit f3c529781c

View File

@ -2,15 +2,16 @@
;; File-related configuration
(defun jdormit-delete-file (file)
(defun my/delete-file (file)
(interactive (list (read-file-name "Delete file: "
nil
nil
t
(buffer-file-name))))
(delete-file file)
(when (string-equal (buffer-file-name) file)
(quit-window)))
(file-name-nondirectory (buffer-file-name)))))
(let ((file (expand-file-name file)))
(delete-file file)
(when (string-equal (buffer-file-name) file)
(quit-window))))
(defun rename-this-file (new-name)
(interactive (list (read-file-name "Rename file: "
@ -35,7 +36,7 @@
"f" '(nil :which-key "file")
"ff" #'find-file
"fs" #'save-buffer
"fD" '(jdormit-delete-file :which-key "delete")
"fD" '(my/delete-file :which-key "delete")
"fr" '(rename-this-file :which-key "rename")
"fd" #'dired)