this post was submitted on 20 Oct 2023
1 points (100.0% liked)

Emacs

311 readers
1 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

Hi.

Still learning Emacs but happy with it so far. One thing i'm trying to find out is this. I'm OK with Emacs creating recovery files from which i can, well, recover my work after emacs is closed. However, if I save my files, I have no need for these #filename# or filename~ files that populate my folders. Is there a way to make emacs keep creating these recovery files, but deleting them if I *save* my actual files?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 1 year ago

First, for making sure the autosave files—the ones prefixed and suffixed by "#"—are cleaned up, ensure that delete-auto-save-files is non-nil (the default) and, if using Emacs 28 or later, set kill-buffer-delete-auto-save-files to non-nil (that would normally be t). As for the backup files ending in "~", those are created on saving a modified file by default and their creation is disabled by setting make-backup-files to a non-nil value.

All of this can be achieved, assuming you're using Emacs 28 or later, by adding

;; Disable backup files.
(setf make-backup-files nil)
;; Prompt to delete autosaves when killing buffers.
(setf kill-buffer-delete-auto-save-files t)

to your init file.