GNU bug report logs - #39189
26.2; recentf should save the list periodically

Previous Next

Package: emacs;

Reported by: ndame <emacsuser <at> freemail.hu>

Date: Sun, 19 Jan 2020 10:21:02 UTC

Severity: wishlist

Found in version 26.2

Full log


Message #8 received at 39189 <at> debbugs.gnu.org (full text, mbox):

From: Pieter van Oostrum <pieter-l <at> vanoostrum.org>
To: ndame <emacsuser <at> freemail.hu>
Cc: 39189 <at> debbugs.gnu.org
Subject: Re: bug#39189: 26.2; recentf should save the list periodically
Date: Sun, 19 Jan 2020 22:49:04 +0100
ndame <emacsuser <at> freemail.hu> writes:

> Currently, recentf saves the recentf list only when emacs exits. Sometimes,
> when emacs crashes I lose recently opened files from the list, because
> the list is not saved periodically.
>
> Emacs should save the list every 10 minutes or so when the user is idle, so
> the recentf list is preserved even if there is a crash.
>

I have the following code in my ~/.emacs.d/init.el:


(defun delayed-recentf-save-list ()
  "Save recent files list when Emacs is idle."
  (run-with-idle-timer 10 nil 'repeat-recentf-save-list))

(defun repeat-recentf-save-list ()
  "Save recent files list when it was changed and Emacs is idle."
  (unless (equal recentf-saved-list recentf-list)
	(recentf-save-list)
	(setq recentf-saved-list recentf-list))
  (run-at-time 120 nil 'delayed-recentf-save-list))

(delayed-recentf-save-list)

It saves periodically (every 2 minutes), but only when the list has changed, and it waits until Emacs is idle for 10 seconds.
-- 
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]




This bug report was last modified 5 years and 145 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.