diff options
author | Johnson Denen <johnson.denen@gmail.com> | 2017-04-16 07:46:54 -0400 |
---|---|---|
committer | Johnson Denen <johnson.denen@gmail.com> | 2017-04-16 07:46:54 -0400 |
commit | 90e1ba9bfc0f06b030a650e5e3d3db162e9bba56 (patch) | |
tree | ef3a7fe76369b067e601d2c08a74320b17f68a57 | |
parent | 43c1e81cd4945d6a96760718647d65a9a349fa4a (diff) |
Update DOCSTRINGs
-rw-r--r-- | lisp/mastodon-tl.el | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index e7100e8..1797615 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -68,6 +68,7 @@ (cdr (assoc key toot))) (defun mastodon-tl--goto-toot-pos (find-pos &optional pos) + "Search for toot with FIND-POS. Optionally stat from POS." (let* ((npos (funcall find-pos (or pos (point)) 'toot-id @@ -77,14 +78,21 @@ (when npos (goto-char npos)))))) (defun mastodon-tl--goto-next-toot () + "Jump to next toot header." (interactive) (mastodon-tl--goto-toot-pos 'next-single-property-change)) (defun mastodon-tl--goto-prev-toot () + "Jump to last toot header." (interactive) (mastodon-tl--goto-toot-pos 'previous-single-property-change)) (defun mastodon-tl--header (handle name id) + "Create header string with toot properties. + +HANDLE is the username. +NAME is the display name. +ID is the toot id." (propertize (concat "=== " (propertize name 'face 'mastodon-tl-toot-display-name-face) @@ -94,17 +102,20 @@ 'toot-id id)) (defun mastodon-tl--remove-html (toot) + "Remove HTML from TOOT." (let* ((t1 (replace-regexp-in-string "<\/p>" "\n\n" toot)) (t2 (replace-regexp-in-string "<\/?span>" "" t1)) (t3 (replace-regexp-in-string "<span class=\"h-card\">" "" t2))) t3)) (defun mastodon-tl--content (toot) + "Distill content to display from TOOT." (let* ((content (mastodon-tl--remove-html toot))) (propertize content 'face 'mastodon-tl-toot-text-face))) (defun mastodon-tl--render-toot (toot) + "Display TOOT with header and content sections." (let ((id (number-to-string (mastodon-tl--from-toot 'id toot))) (handle (mastodon-tl--from-toot 'acct (mastodon-tl--from-toot 'account toot))) (name (mastodon-tl--from-toot 'display_name (mastodon-tl--from-toot 'account toot))) @@ -119,15 +130,18 @@ 'toot-url url)))) (defun mastodon-tl--render-timeline (buffer json) + "Display toots in BUFFER. Data taken from JSON." (switch-to-buffer buffer) (mapcar 'mastodon-tl--render-toot json) (html2text)) (defun mastodon-tl--timeline-name () + "Determine timeline from `buffer-name'." (replace-regexp-in-string "\*" "" (replace-regexp-in-string "mastodon-" "" (buffer-name)))) (defun mastodon-tl--update () + "Update timeline with new toots." (interactive) (let* ((tl (mastodon-tl--timeline-name)) (id (get-text-property (point-min) 'toot-id)) @@ -139,6 +153,7 @@ (mastodon-tl--render-timeline (current-buffer) json))))) (defun mastodon-tl--get (timeline) + "Display toots for TIMELINE in new buffer." (let* ((url (mastodon--api-for (concat "timelines/" timeline))) (tl-buff (concat "*mastodon-" timeline "*")) (tl-json (mastodon-http--get-json url))) |