aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tekuti.el14
1 files changed, 13 insertions, 1 deletions
diff --git a/tekuti.el b/tekuti.el
index ff25a4d..de591b7 100644
--- a/tekuti.el
+++ b/tekuti.el
@@ -74,7 +74,7 @@ with a ‘/’.")
(`("COMMENTS" ,status)
(if (string= status "on")
pair
- (error "Unknown value for comments: %s; Can only be ‘on’ or not present."
+ (error "Unknown value for comments: %s; Can only be ‘on’ or absent"
status)))
(_ pair)))
@@ -105,9 +105,11 @@ with a ‘/’.")
defaults))))
(defun tekuti-form-encode-pair (key value)
+ "Make sure KEY and VALUE are properly form-encoded."
(concat (url-hexify-string key) "=" (url-hexify-string value)))
(defun tekuti-form-encode-data (data)
+ "Convert DATA from an alist to a form-encoded string."
(mapconcat
(lambda (pair)
(tekuti-form-encode-pair (downcase (car pair)) (cadr pair)))
@@ -115,6 +117,12 @@ with a ‘/’.")
"&"))
(defun tekuti--send-finished (status buffer args updatep)
+ "Callback for when the request to tekuti finishes.
+STATUS is the full data structure sent on by ‘url-retrieve’.
+BUFFER is the buffer that was published. ARGS is a list
+containing the data that was collected from the buffer to make
+the request. UPDATEP is a boolean indicating whether a post was
+updated or created."
(pcase-exhaustive status
(`(:redirect ,url . ,_)
(save-excursion
@@ -143,12 +151,16 @@ with a ‘/’.")
(message "Failed to %s post: %d" (if updatep "update" "create") code))))
(defun tekuti--get-update-url ()
+ "Try and get the value of the ‘UPDATE_URL’ property in the current buffer."
(save-excursion
(goto-char (point-min))
(car (map-elt (org-collect-keywords '("UPDATE_URL")) "UPDATE_URL"))))
;;;###autoload
(defun tekuti-send ()
+ "Export and send the current buffer to tekuti.
+The current buffer should be an ‘org-mode’ buffer that you wish
+to post to your tekuti blog."
(interactive)
(let* ((data (tekuti-build-data-from-org))
(url-request-method "POST")