summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--tag-emacs/emacs.d/init.org22
1 files changed, 9 insertions, 13 deletions
diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org
index 21e30d0..2fce27a 100644
--- a/tag-emacs/emacs.d/init.org
+++ b/tag-emacs/emacs.d/init.org
@@ -1665,19 +1665,15 @@ I can use this to keep a journal.  I should use it.
               (run-at-time "00:05" 86400 '(lambda () (org-mobile-push-with-delay 1))) ;; refreshes agenda file each day
               (org-mobile-pull) ;; run org-mobile-pull at startup
 
-              (defun install-monitor (file secs)
-                (run-with-timer
-                 0 secs
-                 (lambda (f p)
-                   (unless (< p (second (time-since (elt (file-attributes f) 5))))
-                     (org-mobile-pull)))
-                 file secs))
-
-              (install-monitor (file-truename
-                                (concat
-                                 (file-name-as-directory org-mobile-directory)
-                                 org-mobile-capture-file))
-                               5)))))
+              (defvar org-mobile-watcher nil)
+              (let ((org-file (expand-file-name
+                               (concat
+                                (file-name-as-directory org-mobile-directory)
+                                org-mobile-capture-file))))
+                (defun ap/org-mobile-pull ()
+                  (org-mobile-pull))
+                (setq org-mobile-watcher
+                      (file-notify-add-watch org-file '(change) #'ap/org-mobile-pull)))))))
 #+END_SRC
 
 * Programming