diff options
author | mousebot <mousebot@riseup.net> | 2022-04-05 17:31:44 +0200 |
---|---|---|
committer | mousebot <mousebot@riseup.net> | 2022-04-05 17:31:44 +0200 |
commit | b3649a12a398537ade7136d704f2f05ccc856e23 (patch) | |
tree | 60a0972a20b3021403e97c1b6baf7a8d6e79cf5d /lisp/mastodon-media.el | |
parent | f7de456e918fdde1c7728e6fe435d9d40d98dd4b (diff) | |
parent | fb69058495574a73df17856014c42370b23d81d7 (diff) |
Merge branch 'develop'
Diffstat (limited to 'lisp/mastodon-media.el')
-rw-r--r-- | lisp/mastodon-media.el | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index 9441bdb..e5a1111 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -307,12 +307,17 @@ Replace them with the referenced image." t image-options)) " "))) -(defun mastodon-media--get-media-link-rendering (media-url &optional full-remote-url type) +(defun mastodon-media--get-media-link-rendering (media-url &optional full-remote-url type caption) "Return the string to be written that renders the image at MEDIA-URL. FULL-REMOTE-URL is used for `shr-browse-image'. -TYPE is the attachment's type field on the server." - (let ((help-echo - "RET/i: load full image (prefix: copy URL), +/-: zoom, r: rotate, o: save preview")) +TYPE is the attachment's type field on the server. +CAPTION is the image caption if provided." + (let* ((help-echo-base "RET/i: load full image (prefix: copy URL), +/-: zoom, r: rotate, o: save preview") + (help-echo (if caption + (concat help-echo-base + "\n\"" + caption "\"") + help-echo-base))) (concat (propertize "[img]" 'media-url media-url @@ -324,7 +329,9 @@ TYPE is the attachment's type field on the server." 'mastodon-tab-stop 'image ; for do-link-action-at-point 'image-url full-remote-url ; for shr-browse-image 'keymap mastodon-tl--shr-image-map-replacement - 'help-echo (if (string= type "image") + 'help-echo (if (or (string= type "image") + (string= type nil) + (string= type "unknown")) ;handle borked images help-echo (concat help-echo "\nC-RET: play " type " with mpv"))) " "))) |