diff options
author | mousebot <mousebot@riseup.net> | 2022-02-12 11:25:39 +0100 |
---|---|---|
committer | mousebot <mousebot@riseup.net> | 2022-02-12 11:25:39 +0100 |
commit | 581cfb870d85324b63e8edaf17a90c0b5c6a9b63 (patch) | |
tree | 362d7e6822512de1a67b170e6781893be21d786f | |
parent | 449929b5734e34aaca226fe1475fd59a10023535 (diff) |
move get-media-types / docstrings.
we have to use mastodon-tl--field for the media types.
we can't use mastodon-tl--property, as the 'attachments property for the toot
doesn't exist yet when we are looking.
-rw-r--r-- | lisp/mastodon-tl.el | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index cfab15d..66b8baa 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -118,15 +118,6 @@ If nil `(point-min)' is used instead.") (defvar-local mastodon-tl--timestamp-update-timer nil "The timer that, when set will scan the buffer to update the timestamps.") -(defun mastodon-tl--get-media-types (toot) - "Return a list of the media attachment types of the TOOT at point." - (let* ((medias (or (alist-get 'media_attachments - (alist-get 'reblog toot)) - (alist-get 'media_attachments toot)))) - (mapcar (lambda (x) - (alist-get 'type x)) - medias))) - (defvar mastodon-tl--link-keymap (let ((map (make-sparse-keymap))) (define-key map [return] 'mastodon-tl--do-link-action-at-point) @@ -334,8 +325,10 @@ Optionally start from POS." (defun mastodon-tl--format-faves-count (toot) "Format a favorites, boosts, replies count for a TOOT. -Used to help-echo when point is at the start of a byline, -i.e. where `mastodon-tl--goto-next-toot' leaves point." +Used to help-echo when point is at the start of a byline, i.e. +where `mastodon-tl--goto-next-toot' leaves point. Also displays a +toot's media types and optionally the binding to play moving +image media from the byline." (let* ((toot-to-count (or ;; simply praying this order works @@ -356,8 +349,18 @@ i.e. where `mastodon-tl--goto-next-toot' leaves point." (format " | C-RET to view with mpv")))) (format "%s" (concat format-faves format-media format-media-binding)))) +(defun mastodon-tl--get-media-types (toot) + "Return a list of the media attachment types of the TOOT at point." + (let* ((attachments (or (alist-get 'media_attachments + (alist-get 'reblog toot)) + (alist-get 'media_attachments toot)))) + (mapcar (lambda (x) + (alist-get 'type x)) + medias))) + (defun mastodon-tl--get-attachments-for-byline (toot) - "Return a list of attachment URLs and types for TOOT." + "Return a list of attachment URLs and types for TOOT. +The result is added as an attachments property to author-byline." (let ((media-attachments (mastodon-tl--field 'media_attachments toot))) (mapcar (lambda (attachement) |