unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#39189: 26.2; recentf should save the list periodically
@ 2020-01-19 10:16 ndame
  2020-01-19 21:49 ` Pieter van Oostrum
  2020-01-23  1:05 ` Stefan Kangas
  0 siblings, 2 replies; 3+ messages in thread
From: ndame @ 2020-01-19 10:16 UTC (permalink / raw)
  To: 39189

[-- Attachment #1: Type: text/plain, Size: 321 bytes --]

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.

[-- Attachment #2: Type: text/html, Size: 350 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#39189: 26.2; recentf should save the list periodically
  2020-01-19 10:16 bug#39189: 26.2; recentf should save the list periodically ndame
@ 2020-01-19 21:49 ` Pieter van Oostrum
  2020-01-23  1:05 ` Stefan Kangas
  1 sibling, 0 replies; 3+ messages in thread
From: Pieter van Oostrum @ 2020-01-19 21:49 UTC (permalink / raw)
  To: ndame; +Cc: 39189

ndame <emacsuser@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]





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#39189: 26.2; recentf should save the list periodically
  2020-01-19 10:16 bug#39189: 26.2; recentf should save the list periodically ndame
  2020-01-19 21:49 ` Pieter van Oostrum
@ 2020-01-23  1:05 ` Stefan Kangas
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Kangas @ 2020-01-23  1:05 UTC (permalink / raw)
  To: ndame; +Cc: 39189

ndame <emacsuser@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.

Yes, that would be useful.

I like the semantics of `bookmark-save-flag'.  Perhaps we could
implement something more similar to that for recentf.

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-23  1:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-19 10:16 bug#39189: 26.2; recentf should save the list periodically ndame
2020-01-19 21:49 ` Pieter van Oostrum
2020-01-23  1:05 ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).