diff options
Diffstat (limited to 'init.el')
-rw-r--r-- | init.el | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -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 |