Closed Andre0991 closed 8 years ago
Oops, sorry for the delay.
It is not very clear about the meaning of "new notification", for example, for the first time, all notifications looks like new to github-notifier.el (or not). Instead I will add a hook which runs whenever github-notifier.el updates, the rest is up to you.
Here is a working example for the new hook, it messages the count of new notification after github-notifier.el updates.
(defun github-notifier--message-new (last-json)
(let ((last-notification-ids
(loop for item in (append last-json nil)
collect (assoc-default 'id item)))
(current-notification-ids
(loop for item in (append github-notifier-unread-json nil)
collect (assoc-default 'id item))))
(message "You have %d new notifications."
(length (-difference
current-notification-ids
last-notification-ids)))))
(add-hook 'github-notifier-update-hook #'github-notifier--message-new)
Cool. Thanks!
Hi.
I think it'd be great if
github-notifier
had a hook that is activated after getting a new notification. That would make it more extensible, which is what Emacs is all about.Of course, I myself could define a function to check
github-notifier-unread-count
value or something like that, but I think it'd be nice forgithub-notifier
to have it.Thanks.