From 8e55a6102e2ed60d40555ef7d130081b5b415a2e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 20 Jan 2016 21:01:25 +0100 Subject: Emacs: Use file-notify for org-mobile --- tag-emacs/emacs.d/init.org | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'tag-emacs') 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 -- cgit 1.4.1