Don't run recentf-cleanup on mode enable; auto-backup recentf file

This commit is contained in:
contrapunctus 2022-02-07 00:04:32 +05:30
parent d419b9a901
commit f7a6c1e30a
1 changed files with 9 additions and 6 deletions

View File

@ -3493,11 +3493,13 @@ But with =initials=, the desired completion is often buried in the results. That
** recentf
#+BEGIN_SRC emacs-lisp
(use-package recentf
:init (recentf-mode 1)
:init
;; default is to cleanup when `recentf-mode' is enabled, which we don't want
(setq recentf-auto-cleanup 'never)
(recentf-mode 1)
:bind ("C-x C-r C-o" . recentf-open-files)
:config
(setq recentf-auto-cleanup 'never
recentf-max-menu-items 500
(setq recentf-max-menu-items 500
recentf-max-saved-items 1000
recentf-save-file (locate-user-emacs-file "recentf")
recentf-exclude '("\\.html\\(\\.orig\\)?$"
@ -3506,9 +3508,10 @@ But with =initials=, the desired completion is often buried in the results. That
"\\.mp4$"
"\\.etc"
"\\.umstuff"))
;; I'd rather run cleanup manually, if ever required; running this
;; automatically is a recipe for periodically losing your recentf
;; entries when your disk happens to be unmounted.
(advice-add 'recentf-save-list :before (lambda (&rest args) (async-backup recentf-save-file)))
;; I'd rather run cleanup manually, if ever required; running
;; cleanup automatically is a recipe for periodically losing your
;; recentf entries when your disk happens to be unmounted.
;; :hook (kill-emacs . recentf-cleanup)
)
#+END_SRC