summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/+elfeed.el17
1 files changed, 14 insertions, 3 deletions
diff --git a/lisp/+elfeed.el b/lisp/+elfeed.el index 7f9e193..c0b74f0 100644 --- a/lisp/+elfeed.el +++ b/lisp/+elfeed.el
@@ -133,6 +133,19 @@ If multiple items are selected, don't advance."
133(defvar +elfeed--update-first-time 6 "How long to wait for the first time.") 133(defvar +elfeed--update-first-time 6 "How long to wait for the first time.")
134(defvar +elfeed--update-repeat (* 60 15) "How long between updates.") 134(defvar +elfeed--update-repeat (* 60 15) "How long between updates.")
135 135
136(defcustom +elfeed-update-proceed-hook nil
137 "Predicates to query before running `+elfeed-update-command'.
138Each hook is passed no arguments."
139 :type 'hook)
140
141(defun +elfeed-update-command-wrapper ()
142 "Run `+elfeed-update-command', but only sometimes.
143If any of the predicates in `+elfeed-update-proceed-hook' return
144nil, don't run `+elfeed-update-command'. If they all return
145non-nil, proceed."
146 (when (run-hook-with-args-until-failure '+elfeed-update-proceed-hook)
147 (+elfeed-update-command)))
148
136(defun +elfeed--cancel-update-timer () 149(defun +elfeed--cancel-update-timer ()
137 "Cancel `+elfeed--update-timer'." 150 "Cancel `+elfeed--update-timer'."
138 (unless +elfeed--update-running 151 (unless +elfeed--update-running
@@ -142,12 +155,10 @@ If multiple items are selected, don't advance."
142(defun +elfeed--reinstate-update-timer () 155(defun +elfeed--reinstate-update-timer ()
143 "Reinstate `+elfeed--update-timer'." 156 "Reinstate `+elfeed--update-timer'."
144 ;; First, unload the db 157 ;; First, unload the db
145 (elfeed-db-save)
146 (elfeed-db-unload)
147 (setq +elfeed--update-timer 158 (setq +elfeed--update-timer
148 (run-at-time +elfeed--update-first-time 159 (run-at-time +elfeed--update-first-time
149 +elfeed--update-repeat 160 +elfeed--update-repeat
150 #'+elfeed-update-command))) 161 #'+elfeed-update-command-wrapper)))
151 162
152(define-minor-mode +elfeed-update-async-mode 163(define-minor-mode +elfeed-update-async-mode
153 "Minor mode to update elfeed async-style." 164 "Minor mode to update elfeed async-style."