about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--config.org15
1 files changed, 11 insertions, 4 deletions
diff --git a/config.org b/config.org index 0fa3911..eed895a 100644 --- a/config.org +++ b/config.org
@@ -799,12 +799,19 @@ from [[https://www.reddit.com/r/emacs/comments/km9by4/weekly_tipstricketc_thread
799 (recentf-mode +1) 799 (recentf-mode +1)
800 800
801 ;; save recentf list when focusing away 801 ;; save recentf list when focusing away
802 (defun acdw/save-recentf-when-nonfocused () 802 (defun acdw/maybe-save-recentf ()
803 "Save `recentf-file' when out of focus." 803 "Save `recentf-file' when out of focus, but only if we haven't
804 (acdw/when-unfocused #'recentf-save-list)) 804 in five minutes."
805 (defvar recentf-last-save (time-convert nil 'integer)
806 "How long it's been since we last saved the recentf list.")
807
808 (when (> (time-convert (time-since recentf-last-save) 'integer)
809 (* 60 5))
810 (setq recentf-last-save (time-convert nil 'integer))
811 (acdw/when-unfocused #'recentf-save-list)))
805 812
806 (add-function :after after-focus-change-function 813 (add-function :after after-focus-change-function
807 #'acdw/save-recentf-when-nonfocused) 814 #'acdw/maybe-save-recentf)
808#+END_SRC 815#+END_SRC
809 816
810** Undo 817** Undo