branch: elpa/mastodon
commit c4bcbd60b671f5ad514f70e5263ed1f7f5dd42a2
Author: marty hiatt <martianhia...@disroot.org>
Commit: marty hiatt <martianhia...@disroot.org>

    image cycle: re-write mastodon-tl--get-next-image-url!
---
 lisp/mastodon-tl.el | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 47f0b66fe4..272c2ff9fc 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -1473,19 +1473,18 @@ the URL of the image to the kill buffer instead."
 (defun mastodon-tl--get-next-image-url ()
   "Return the url for the next image to load.
 Cycles through values in `mastodon-media--attachments'."
-  (cl-loop for attachment in (cdr mastodon-media--attachments)
-           for url = (car mastodon-media--attachments)
-           ;; match url against our plists:
-           for current = (cl-member-if
-                          (lambda (attachment)
-                            (equal url (plist-get attachment :url)))
-                          (cdr mastodon-media--attachments))
-           ;; fetch from next item in current or use first item if current
-           ;; has only 1 item:
-           return (plist-get (if (= 1 (length current))
-                                 (cadr mastodon-media--attachments)
-                               (cadr current))
-                             :url)))
+  (let* ((url (car mastodon-media--attachments))
+         ;; match url against our plists:
+         (current  (cl-member-if
+                    (lambda (attachment)
+                      (equal url (plist-get attachment :url)))
+                    (cdr mastodon-media--attachments))))
+    ;; fetch from next item in current or use first item if current has
+    ;; only 1 item:
+    (plist-get (if (= 1 (length current))
+                   (cadr mastodon-media--attachments)
+                 (cadr current))
+               :url)))
 
 (defun mastodon-tl-next-full-image ()
   "From full image view buffer, load the toot's next image."

Reply via email to