branch: externals/bufferlo commit fb760a635f88d285b9bd3479480a0d18d7bb13c4 Author: shipmints <shipmi...@gmail.com> Commit: shipmints <shipmi...@gmail.com>
Change idle save timer to disallow reentrancy --- bufferlo.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bufferlo.el b/bufferlo.el index a959c46d35..c2521f5f46 100644 --- a/bufferlo.el +++ b/bufferlo.el @@ -468,7 +468,7 @@ 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-idle-timer bufferlo-bookmarks-auto-save-idle-interval t #'bufferlo-bookmarks-save)))) + (run-with-idle-timer bufferlo-bookmarks-auto-save-idle-interval nil #'bufferlo--bookmarks-save-timer-cb)))) (defcustom bufferlo-bookmarks-auto-save-idle-interval 0 "Save bufferlo bookmarks when Emacs has been idle this many seconds. @@ -2744,6 +2744,14 @@ 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." + (bufferlo-bookmarks-save) + ;; reschedule the save timer as soon as Emacs allows + (run-with-timer 0 nil #'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