From a14ecfce170e82ae610247b8ed1854077deed8c0 Mon Sep 17 00:00:00 2001 From: mousebot Date: Thu, 10 Mar 2022 13:09:47 +0100 Subject: display image caption in help echo --- lisp/mastodon-media.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lisp/mastodon-media.el') diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index 9441bdb..f79b1fa 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -307,12 +307,16 @@ 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")) + (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 -- cgit v1.2.3 From 5239dc08a361c98a484447b2848c4b2997e072c6 Mon Sep 17 00:00:00 2001 From: mousebot Date: Fri, 11 Mar 2022 12:50:55 +0100 Subject: don't add play with mpv help-echo if media type is "unknown" "unknown" type is given when a media image fails to load or similar. nil is e.g. when a profile picture isn't given, and missing.png is used as a replacement --- lisp/mastodon-media.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lisp/mastodon-media.el') diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index f79b1fa..383e062 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -328,7 +328,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"))) " "))) -- cgit v1.2.3 From fb69058495574a73df17856014c42370b23d81d7 Mon Sep 17 00:00:00 2001 From: mousebot Date: Tue, 5 Apr 2022 17:17:59 +0200 Subject: flychecks and docstrings --- lisp/mastodon-media.el | 3 ++- lisp/mastodon-notifications.el | 4 +++- lisp/mastodon-tl.el | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) (limited to 'lisp/mastodon-media.el') diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index 383e062..e5a1111 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -310,7 +310,8 @@ Replace them with the referenced image." (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." +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 diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index 6b253ec..5de7354 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -233,7 +233,9 @@ such as boosting favouriting and following to the byline. It also takes a single function. By default it is `mastodon-tl--byline-boosted'. -ID is the notification's own id, which is attached as a property." +ID is the notification's own id, which is attached as a property. +If the status is a favourite or a boost, PARENT-TOOT is the JSON +of the toot responded to." (when toot ; handle rare blank notif server bug (mastodon-tl--insert-status toot body author-byline action-byline id parent-toot))) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 40cbcae..3c96ecc 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -865,7 +865,8 @@ takes a single function. By default it is `mastodon-tl--byline-boosted'. ID is that of the toot, which is attached as a property if it is -a notification." +a notification. If the status is a favourite or a boost, +PARENT-TOOT is the JSON of the toot responded to." (let ((start-pos (point))) (insert (propertize -- cgit v1.2.3