From f8f4aff3312f0fb6f07c0c34196c9d12b2288208 Mon Sep 17 00:00:00 2001 From: Johnson Denen Date: Tue, 18 Apr 2017 15:48:50 -0400 Subject: Add thread functionality to timelines --- lisp/mastodon-tl.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index e1487bd..cec6e79 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -169,6 +169,22 @@ Return value from boosted content if available." (goto-char (point-min)) (mastodon-tl--property 'toot-id)) +(defun mastodon-tl--thread () + "Open thread buffer for toot under `point'." + (interactive) + (let* ((id (number-to-string (mastodon-tl--property 'toot-id))) + (url (mastodon--api-for (format "statuses/%s/context" id))) + (buffer (format "*mastodon-thread-%s*" id)) + (toot (mastodon-tl--property 'toot-json)) + (context (mastodon-http--get-json url))) + (with-output-to-temp-buffer buffer + (switch-to-buffer buffer) + (mastodon-tl--timeline (vconcat + (cdr (assoc 'ancestors context)) + `(,toot) + (cdr (assoc 'descendants context))))) + (mastodon-mode))) + (defun mastodon-tl--update () "Update timeline with new toots." (interactive) -- cgit v1.2.3