branch: externals/bufferlo commit 09702d8e79ff9bb7c9a4172e5ed148edd3f68919 Author: shipmints <shipmi...@gmail.com> Commit: shipmints <shipmi...@gmail.com>
Make the auto-save timer an idle timer Correctly implemented, this time. --- bufferlo.el | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/bufferlo.el b/bufferlo.el index d4abd86ed4..7e5312177c 100644 --- a/bufferlo.el +++ b/bufferlo.el @@ -541,9 +541,10 @@ This is controlled by `bufferlo-bookmarks-auto-save-idle-interval'.") (bufferlo--bookmarks-auto-save-timer-maybe-cancel) (when (> bufferlo-bookmarks-auto-save-idle-interval 0) (setq bufferlo--bookmarks-auto-save-timer - (run-with-timer + (run-with-idle-timer bufferlo-bookmarks-auto-save-idle-interval - nil #'bufferlo--bookmarks-save-timer-cb)))) + bufferlo-bookmarks-auto-save-idle-interval + #'bufferlo-bookmarks-save)))) (defcustom bufferlo-bookmarks-auto-save-idle-interval 0 "Save bufferlo bookmarks when Emacs has been idle this many seconds. @@ -3130,15 +3131,6 @@ Specify NO-MESSAGE to inhibit the bookmark save status message." (memq bufferlo-bookmarks-auto-save-messages (list 'notsaved t))) (message "No bufferlo bookmarks saved.")))))) -(defun bufferlo--bookmarks-save-timer-cb () - "Save active bufferlo bookmarks per an optional idle timer. -`bufferlo-bookmarks-auto-save-idle-interval' is treated as a -one-shot timer to prevent reentrancy." - (if (current-idle-time) - (bufferlo-bookmarks-save) - (run-with-idle-timer 0.1 nil #'bufferlo-bookmarks-save)) - (bufferlo--bookmarks-auto-save-timer-maybe-start)) - (defun bufferlo-bookmarks-save (&optional all) "Save active bufferlo bookmarks. This is invoked via an optional idle timer which runs according