Commit 80da9a3c8420

Vincent Demeester <vincent@sbr.pm>
2026-01-28 14:46:17
feat(emacs): enable versioned backups to central directory
Store numbered backups in ~/.local/share/emacs/backups/ instead of alongside files. Keeps 10 newest and 2 oldest versions per file. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent eab8275
Changed files (1)
dots
.config
emacs
dots/.config/emacs/init.el
@@ -264,9 +264,15 @@ Otherwise, call `backward-kill-word'."
   ;; ("M-n" . #'completion-preview-next-candidate)
   ;; ("M-p" . #'completion-preview-prev-candidate))
   :custom
-  (create-lockfiles nil)   ; No backup files
-  (make-backup-files nil)  ; No backup files
-  (backup-inhibited t)     ; No backup files
+  (create-lockfiles nil)
+  ;; Versioned backups in central directory
+  (make-backup-files t)
+  (version-control t)                    ; Numbered backups
+  (kept-new-versions 10)                 ; Keep 10 newest
+  (kept-old-versions 2)                  ; Keep 2 oldest
+  (delete-old-versions t)                ; Auto-delete excess
+  (backup-by-copying t)                  ; Don't clobber symlinks
+  (backup-directory-alist '(("." . "~/.local/share/emacs/backups/")))
   (use-short-answers t "Use short answer y/n")
   ;; (tab-always-indent 'complete)
   ;; (tab-first-completion 'word-or-paren-or-punct)
@@ -274,7 +280,6 @@ Otherwise, call `backward-kill-word'."
   ;; (select-enable-clipboard t)
   ;; (select-enable-primary t)
   (comment-multi-line t)
-  (make-backup-files nil)
   (read-extended-command-predicate #'command-completion-default-include-p)
   (mouse-autoselect 1)
   (completion-cycle-threshold 2)