summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2019-12-02 14:32:22 +0000
committerjao <jao@gnu.org>2019-12-02 14:32:22 +0000
commit63e866091425bff5f292c68b0ba83e9e9fed8b78 (patch)
treed6113b87c963e3cf9696d6dcd7c7fc32b7bc515f
parent087c3881b2365de87c8707d728b06873d508d706 (diff)
downloadelibs-63e866091425bff5f292c68b0ba83e9e9fed8b78.tar.gz
elibs-63e866091425bff5f292c68b0ba83e9e9fed8b78.tar.bz2
jao-maildir: callbacks
-rw-r--r--net/jao-maildir.el13
1 files changed, 7 insertions, 6 deletions
diff --git a/net/jao-maildir.el b/net/jao-maildir.el
index ed082a0..2c4d67c 100644
--- a/net/jao-maildir.el
+++ b/net/jao-maildir.el
@@ -50,26 +50,27 @@
(when jao-maildir-debug-p
(message "watch: %s: %s" mbox e)))
-(defun jao-maildir--watcher (mbox)
+(defun jao-maildir--watcher (mbox cb)
(lambda (e)
(jao-maildir--log-watch e mbox)
(when (memq (cadr e) '(created deleted))
(setcdr (assoc mbox jao-maildir-counts)
- (jao-maildir--maildir-new-count mbox)))))
+ (jao-maildir--maildir-new-count mbox))
+ (when cb (funcall cb mbox)))))
-(defun jao-maildir--setup-watches ()
+(defun jao-maildir--setup-watches (cb)
(jao-maildir-cancel-watchers)
(setq jao-maildir--watches
(mapcar (lambda (mbox)
(file-notify-add-watch (jao-maildir--maildir-new mbox)
'(change)
- (jao-maildir--watcher mbox)))
+ (jao-maildir--watcher mbox cb)))
jao-maildirs)))
-(defun jao-maildir-setup (maildirs)
+(defun jao-maildir-setup (maildirs &optional cb)
(setq jao-maildirs maildirs)
(setq jao-maildir-counts (jao-maildir-counts))
- (jao-maildir--setup-watches))
+ (jao-maildir--setup-watches cb))
(provide 'jao-maildir)