Skip to content

Instantly share code, notes, and snippets.

@matburt
Created January 13, 2016 05:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matburt/974d91298233cf12e623 to your computer and use it in GitHub Desktop.
Save matburt/974d91298233cf12e623 to your computer and use it in GitHub Desktop.
Emacs module for submitting org journal items to idonethis
(defun org-idonethis-capture ()
"Captures captures and sends them to idonethis"
(message "before hook")
(cond ((string-match "\:tag-to-match\:" (buffer-string))
(goto-char (point-min))
(search-forward "****")
(setq note-contents (buffer-substring (+ (point) 1) (line-end-position)))
(message note-contents)
(request
"https://idonethis.com/api/v0.1/dones/"
:type "POST"
:data (format "{\"raw_text\": \"%s\", \"team\": \"<idonethisteam>\"}" note-contents)
:headers '(("Content-Type" . "application/json") ("Authorization" . "Token <idonethistoken>"))
:parser 'buffer-string
:success
(function* (lambda (&key data &allow-other-keys)
(message data)))
:complete (lambda (&rest _) (message "Sent to idonethis"))
:status-code '((400 . (lambda (&rest _) (message "Got 400 Submitting to idonethis"))))))))
(add-hook 'org-capture-prepare-finalize-hook 'org-idonethis-capture)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment