branch: elpa/mastodon
commit e8696a98f12ee29481cf9b94414d319f121ff438
Author: marty hiatt <[email protected]>
Commit: marty hiatt <[email protected]>

    add custom options for check for updates, check interval
---
 lisp/mastodon-notifications.el | 14 ++++++++------
 lisp/mastodon.el               |  8 ++++++++
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el
index 51452f6292..77c0423072 100644
--- a/lisp/mastodon-notifications.el
+++ b/lisp/mastodon-notifications.el
@@ -982,12 +982,14 @@ NOTE means to include a profile note."
 
 (defun mastodon-notifications-update-with-timer ()
   "Run a timer to update notifications. Added to `mastodon-mode-hook'."
-  ;; cancel existing timer:
-  (when mastodon-notifications-timer
-    (cancel-timer mastodon-notifications-timer))
-  ;; set new timer:
-  (setq mastodon-notifications-timer
-        (run-at-time 60 nil #'mastodon-notifications-update-check)))
+  (when mastodon-notifications-check-for-updates
+    ;; cancel existing timer:
+    (when mastodon-notifications-timer
+      (cancel-timer mastodon-notifications-timer))
+    ;; set new timer:
+    (setq mastodon-notifications-timer
+          (run-at-time mastodon-notifications-updates-interval
+                       nil #'mastodon-notifications-update-check))))
 
 (defun mastodon-notifications-update-check ()
   "Function called by `mastodon-notifications-update-with-timer'.
diff --git a/lisp/mastodon.el b/lisp/mastodon.el
index 9ec106889f..99a532628b 100644
--- a/lisp/mastodon.el
+++ b/lisp/mastodon.el
@@ -193,6 +193,14 @@ A count of 2 for example means to display like so: \"Bob, 
Jenny
 and X others...\"."
   :type '(integer))
 
+(defcustom mastodon-notifications-check-for-updates t
+  "Whether to regularly check for new notifications."
+  :type '(boolean))
+
+(defcustom mastodon-notifications-updates-interval 60
+  "How often to check for new notifications, in seconds."
+  :type '(integer))
+
 (defun mastodon-kill-window ()
   "Quit window and delete helper."
   (interactive)

Reply via email to