diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mastodon-client.el | 4 | ||||
-rw-r--r-- | lisp/mastodon-http.el | 3 | ||||
-rw-r--r-- | lisp/mastodon-tl.el | 8 | ||||
-rw-r--r-- | lisp/mastodon-toot.el | 2 | ||||
-rw-r--r-- | lisp/mastodon.el | 6 |
5 files changed, 18 insertions, 5 deletions
diff --git a/lisp/mastodon-client.el b/lisp/mastodon-client.el index 5633591..e542129 100644 --- a/lisp/mastodon-client.el +++ b/lisp/mastodon-client.el @@ -83,9 +83,9 @@ Make `mastodon-client--fetch' call to determine client values." (delete "mastodon" mastodon)))) (defun mastodon-client () - "Return `mastodon-client' plist. + "Return variable `mastodon-client' plist. -Read plist from `mastodon-token-file' if `mastodon-client' is nil. +Read plist from `mastodon-token-file' if variable is nil. Fetch and store plist if `mastodon-client--read' returns nil." (or mastodon-client (setq mastodon-client diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el index 4c5d3dc..11260a1 100644 --- a/lisp/mastodon-http.el +++ b/lisp/mastodon-http.el @@ -60,6 +60,9 @@ (match-string 0 status-line)))) (defun mastodon-http--triage (response success) + "Determine if RESPONSE was successful. Call SUCCESS if successful. + +Open RESPONSE buffer if unsuccessful." (let ((status (with-current-buffer response (mastodon-http--status)))) (if (string-prefix-p "2" status) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 8160f52..18c7b64 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -90,6 +90,7 @@ Optionally start from POS." (replace-regexp-in-string "mastodon-" "" (buffer-name)))) (defun mastodon-tl--remove-html (toot) + "Remove unrendered tags from TOOT." (let* ((t1 (replace-regexp-in-string "<\/p>" "\n\n" toot)) (t2 (replace-regexp-in-string "<\/?span>" "" t1))) (replace-regexp-in-string "<span class=\"h-card\">" "" t2))) @@ -126,6 +127,7 @@ Return value from boosted content if available." (cdr (assoc field toot)))) (defun mastodon-tl--byline (toot) + "Generate byline for TOOT." (let ((id (cdr (assoc 'id toot))) (faved (mastodon-tl--field 'favourited toot)) (boosted (mastodon-tl--field 'reblogged toot))) @@ -151,6 +153,7 @@ Return value from boosted content if available." 'face 'default))) (defun mastodon-tl--toot (toot) + "Display TOOT content and byline." (insert (concat (mastodon-tl--content toot) @@ -158,6 +161,7 @@ Return value from boosted content if available." "\n\n"))) (defun mastodon-tl--timeline (toots) + "Display each toot in TOOTS." (mapcar 'mastodon-tl--toot toots) (replace-regexp "\n\n\n | " "\n | " nil (point-min) (point-max))) @@ -180,7 +184,9 @@ Return value from boosted content if available." (mastodon-http--get-json url))) (defun mastodon-tl--property (prop &optional backward) - "Get property PROP for toot at point." + "Get property PROP for toot at point. + +Move forward (down) the timeline unless BACKWARD is non-nil." (or (get-text-property (point) prop) (progn (if backward diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index aa3cfeb..3e865b3 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -104,7 +104,7 @@ (define-key map (kbd "C-c C-c") #'mastodon-toot--send) (define-key map (kbd "C-c C-k") #'mastodon-toot--cancel) map) - "Keymap for `mastodon-toot-mode'.") + "Keymap for `mastodon-toot'.") (define-minor-mode mastodon-toot-mode "Minor mode to capture Mastodon toots." diff --git a/lisp/mastodon.el b/lisp/mastodon.el index b256a7c..aac580f 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -70,13 +70,17 @@ ;;;###autoload (defun mastodon () + "Connect Mastodon client to `mastodon-instance-url' instance." (interactive) (require 'mastodon-tl) (mastodon-tl--get "home")) ;;;###autoload (defun mastodon-toot (&optional user reply-to-id) - "Update a Mastodon instance with new toot. Content is captured in a new buffer." + "Update instance with new toot. Content is captured in a new buffer. + +If USER is non-nil, insert after @ symbol to begin new toot. +If REPLY-TO-ID is non-nil, attach new toot to a conversation." (interactive) (require 'mastodon-toot) (progn |