Skip to content

Instantly share code, notes, and snippets.

@markhepburn
Created February 10, 2013 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markhepburn/4749358 to your computer and use it in GitHub Desktop.
Save markhepburn/4749358 to your computer and use it in GitHub Desktop.
(defvar org-mobile-push-timer nil
"Timer that `org-mobile-push-timer' used to reschedule itself, or nil.")
(defun org-mobile-push-with-delay (secs)
(when org-mobile-push-timer
(cancel-timer org-mobile-push-timer))
(setq org-mobile-push-timer
(run-with-idle-timer
(* 1 secs) nil 'org-mobile-push)))
(add-hook 'after-save-hook
(lambda ()
(when (eq major-mode 'org-mode)
(dolist (file (org-mobile-files-alist))
(if (string= (expand-file-name (car file)) (buffer-file-name))
(org-mobile-push-with-delay 30)))
)))
(run-at-time "00:05" 86400 '(lambda () (org-mobile-push-with-delay 1))) ;; refreshes agenda file each day
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment