[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/mastodon 8f8c461e01 20/63: wrap --thread in with-item macr
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/mastodon 8f8c461e01 20/63: wrap --thread in with-item macro |
Date: |
Sun, 4 Aug 2024 04:00:31 -0400 (EDT) |
branch: elpa/mastodon
commit 8f8c461e01a9cd85624b40bb158607f4240c80e6
Author: marty hiatt <martianhiatus@riseup.net>
Commit: marty hiatt <martianhiatus@riseup.net>
wrap --thread in with-item macro
---
lisp/mastodon-tl.el | 73 +++++++++++++++++++++++++++--------------------------
1 file changed, 37 insertions(+), 36 deletions(-)
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index c4585b82e8..a82d437b57 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -1979,42 +1979,43 @@ view all branches of a thread."
(defun mastodon-tl--thread (&optional id)
"Open thread buffer for toot at point or with ID."
(interactive)
- (let* ((id (or id (mastodon-tl--property 'base-item-id :no-move)))
- (type (mastodon-tl--field 'type (mastodon-tl--property 'item-json
:no-move))))
- (if (or (string= type "follow_request")
- (string= type "follow")) ; no can thread these
- (user-error "No thread")
- (let* ((endpoint (format "statuses/%s/context" id))
- (url (mastodon-http--api endpoint))
- (buffer (format "*mastodon-thread-%s*" id))
- (toot (mastodon-http--get-json ; refetch in case we just
faved/boosted:
- (mastodon-http--api (concat "statuses/" id))
- nil :silent))
- (context (mastodon-http--get-json url nil :silent)))
- (if (equal (caar toot) 'error)
- (user-error "Error: %s" (cdar toot))
- (when (member (alist-get 'type toot) '("reblog" "favourite"))
- (setq toot (alist-get 'status toot)))
- (if (> (+ (length (alist-get 'ancestors context))
- (length (alist-get 'descendants context)))
- 0)
- ;; if we have a thread:
- (with-mastodon-buffer buffer #'mastodon-mode nil
- (let ((marker (make-marker)))
- (mastodon-tl--set-buffer-spec buffer endpoint
- #'mastodon-tl--thread)
- (mastodon-tl--timeline (alist-get 'ancestors context)
:thread)
- (goto-char (point-max))
- (move-marker marker (point))
- ;; print re-fetched toot:
- (mastodon-tl--toot toot :detailed-p :thread)
- (mastodon-tl--timeline (alist-get 'descendants context)
- :thread)
- ;; put point at the toot:
- (goto-char (marker-position marker))
- (mastodon-tl--goto-next-item)))
- ;; else just print the lone toot:
- (mastodon-tl--single-toot id)))))))
+ (mastodon-tl--with-toot-item
+ (let* ((id (or id (mastodon-tl--property 'base-item-id :no-move)))
+ (type (mastodon-tl--field 'type (mastodon-tl--property 'item-json
:no-move))))
+ (if (or (string= type "follow_request")
+ (string= type "follow")) ; no can thread these
+ (user-error "No thread")
+ (let* ((endpoint (format "statuses/%s/context" id))
+ (url (mastodon-http--api endpoint))
+ (buffer (format "*mastodon-thread-%s*" id))
+ (toot (mastodon-http--get-json ; refetch in case we just
faved/boosted:
+ (mastodon-http--api (concat "statuses/" id))
+ nil :silent))
+ (context (mastodon-http--get-json url nil :silent)))
+ (if (equal (caar toot) 'error)
+ (user-error "Error: %s" (cdar toot))
+ (when (member (alist-get 'type toot) '("reblog" "favourite"))
+ (setq toot (alist-get 'status toot)))
+ (if (> (+ (length (alist-get 'ancestors context))
+ (length (alist-get 'descendants context)))
+ 0)
+ ;; if we have a thread:
+ (with-mastodon-buffer buffer #'mastodon-mode nil
+ (let ((marker (make-marker)))
+ (mastodon-tl--set-buffer-spec buffer endpoint
+ #'mastodon-tl--thread)
+ (mastodon-tl--timeline (alist-get 'ancestors context)
:thread)
+ (goto-char (point-max))
+ (move-marker marker (point))
+ ;; print re-fetched toot:
+ (mastodon-tl--toot toot :detailed-p :thread)
+ (mastodon-tl--timeline (alist-get 'descendants context)
+ :thread)
+ ;; put point at the toot:
+ (goto-char (marker-position marker))
+ (mastodon-tl--goto-next-item)))
+ ;; else just print the lone toot:
+ (mastodon-tl--single-toot id))))))))
(defun mastodon-tl--mute-thread ()
"Mute the thread displayed in the current buffer.
- [nongnu] elpa/mastodon updated (a191fb5f3f -> 45903de823), ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 2d4cedbf68 01/63: readme re bookmarks, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 9b1b08c9b3 02/63: img help echo: cmd keys and toggle sensitive binding, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon aa6b7b25be 18/63: readme re tofu, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 92e1e7b991 03/63: move/rename with-toot-item, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 8f8c461e01 20/63: wrap --thread in with-item macro,
ELPA Syncer <=
- [nongnu] elpa/mastodon 6e24c36e86 07/63: screenshots, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon f43ecd6bad 06/63: docstring, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 8df12b8808 15/63: update info, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon e9ddf28832 21/63: horiz-bar refactor, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 00ac9103ad 25/63: multisession var in -toot.el, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 8c4f18cca7 32/63: toot--insert-emoji: defalis -> defun., ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 3eb1c4f794 41/63: --thread: diff name for option arg to avoid macro var, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 028ab8ea22 43/63: fix newlines accumulating on (un)folding toots, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 134ec9413a 45/63: small adjustments to point placement with (un)folding, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon cf72fb5af0 47/63: bind fold toggle, ELPA Syncer, 2024/08/04