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