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?

  • sandbox_actual@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    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.