开发者

How to periodically run a task within emacs?

开发者 https://www.devze.com 2023-01-18 04:49 出处:网络
Is there a way to periodically run an elisp function in a long-running emacs, similar to cron, but within the emacs process?

Is there a way to periodically run an elisp function in a long-running emacs, similar to cron, but within the emacs process?

For example I want to "automatically run (recentf-save-list) every half hour" because it otherwise only runs on exit, which sucks when emacs occasionally crashes.开发者_开发技巧 (There are other examples as well so looking for a general solution rather than one in particular for recentf).


Check out run-with-timer.

(run-with-timer 0 (* 30 60) 'recentf-save-list)


You might also find midnight mode useful. One can arbitrarily define 'midnight' and then add hooks as desired.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号