00-clean.el (2412B)
1 ;;; 00-clean.el --- -*- lexical-binding: t; -*- 2 ;;; Commentary: 3 ;;; no-littering and recentf configurations 4 ;;; Note: this file is autogenerated from an org-mode file. 5 ;;; Code: 6 7 (setopt make-backup-files nil) 8 (setopt backup-inhibited nil) ; Not sure if needed, given `make-backup-files' 9 (setopt create-lockfiles nil) 10 11 (use-package recentf 12 :config 13 (setq recentf-max-saved-items 200 14 recentf-auto-cleanup 360 15 recentf-show-file-shortcuts-flag nil) 16 (recentf-mode 1) 17 (add-to-list 'recentf-exclude "^/\\(?:ssh\\|su\\|sudo\\)?:") 18 ;; Magic advice to rename entries in recentf when moving files in 19 ;; dired. 20 (defun rjs/recentf-rename-notify (oldname newname &rest args) 21 (if (file-directory-p newname) 22 (rjs/recentf-rename-directory oldname newname) 23 (rjs/recentf-rename-file oldname newname))) 24 25 (defun rjs/recentf-rename-file (oldname newname) 26 (setq recentf-list 27 (mapcar (lambda (name) 28 (if (string-equal name oldname) 29 newname 30 oldname)) 31 recentf-list)) 32 recentf-cleanup) 33 34 (defun rjs/recentf-rename-directory (oldname newname) 35 ;; oldname, newname and all entries of recentf-list should already 36 ;; be absolute and normalised so I think this can just test whether 37 ;; oldname is a prefix of the element. 38 (setq recentf-list 39 (mapcar (lambda (name) 40 (if (string-prefix-p oldname name) 41 (concat newname (substring name (length oldname))) 42 name)) 43 recentf-list)) 44 recentf-cleanup) 45 46 (advice-add 'dired-rename-file :after #'rjs/recentf-rename-notify)) 47 48 49 ;; 2024-07-08: Do I have to setup this, or should I do like prot, disable *all* backup, lockfile, … 50 (use-package no-littering ; Keep .emacs.d clean 51 :config 52 (require 'recentf) 53 (add-to-list 'recentf-exclude no-littering-var-directory) 54 (add-to-list 'recentf-exclude no-littering-etc-directory) 55 56 ;; Move this in its own thing 57 (setq 58 create-lockfiles nil 59 delete-old-versions t 60 kept-new-versions 6 61 kept-old-versions 2 62 version-control t) 63 64 (setq 65 backup-directory-alist 66 `((".*" . ,(no-littering-expand-var-file-name "backup/"))) 67 auto-save-file-name-transforms 68 `((".*" ,(no-littering-expand-var-file-name "auto-save/") t)))) 69 70 (provide '00-clean) 71 ;;; 00-clean.el ends here