Skip to content

Instantly share code, notes, and snippets.

@psamim
Created May 31, 2014 18:54
Show Gist options
  • Save psamim/1fb8ba2ac36c557f502d to your computer and use it in GitHub Desktop.
Save psamim/1fb8ba2ac36c557f502d to your computer and use it in GitHub Desktop.
(defun psamim-push-gtasks-todos ()
"Asynchronously syncs to Google tasks"
(interactive)
(org-tags-sparse-tree t "+TODO=\"NEXT\"")
(org-export-visible ?\s nil)
(delete-matching-lines "^\* .*")
(replace-string "** NEXT" "*")
(write-file psamim-mobile-todo-org-file nil)
(my-window-killer)
(message "Pushing todos started")
(let ((process
(start-process
"gtasks-sync" "*sync-output*" "/bin/sh" "-c"
(concat
;; Uses michel-orgmode script
"torify ~/src/michel-orgmode/michel/michel.py --push --orgfile "
psamim-mobile-todo-org-file
" --listname "
psamim-mobile-todo-list))))
(set-process-sentinel process 'gtasks-sentinel)))
(defun gtasks-sentinel (p e)
"Display the result of the sync"
(if (= 0 (process-exit-status p))
(message "Google tasks sync was successful")
(message "Sync failed")))
(provide 'init-sync)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment