Created
January 13, 2016 05:33
-
-
Save matburt/974d91298233cf12e623 to your computer and use it in GitHub Desktop.
Emacs module for submitting org journal items to idonethis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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