aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-tl.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus@riseup.net>2024-06-05 20:21:26 +0200
committermarty hiatt <martianhiatus@riseup.net>2024-06-05 20:21:26 +0200
commit73d91dd163b7c7a8401aba26c5f41b13277239da (patch)
treefc41c354d31284a02117d5d540b0db553be7a93c /lisp/mastodon-tl.el
parent4b892cad51b4dacbc2a00426c90223b8fe97ac09 (diff)
add check to sensitive media toggle
Diffstat (limited to 'lisp/mastodon-tl.el')
-rw-r--r--lisp/mastodon-tl.el31
1 files changed, 16 insertions, 15 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 166a0a4..122e7fb 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -100,6 +100,7 @@
(defvar mastodon-toot-timestamp-format)
(defvar shr-use-fonts) ;; declare it since Emacs24 didn't have this
(defvar mastodon-media--enable-image-caching)
+(defvar mastodon-media--generic-broken-image-data)
(defvar mastodon-mode-map)
@@ -1217,25 +1218,25 @@ SENSITIVE is a flag from the item's JSON data."
(url-retrieve url #'mastodon-media--process-full-sized-image-response
`(,url)))))))
-(defvar mastodon-media--generic-broken-image-data)
-
(defun mastodon-tl--toggle-sensitive-image ()
"Toggle dislay of sensitive image at point."
(interactive)
- (let ((data (mastodon-tl--property 'image-data :no-move))
- (inhibit-read-only t)
- (end (next-single-property-change (point) 'sensitive-state)))
- (if (equal 'hidden (mastodon-tl--property 'sensitive-state :no-move))
- ;; display sensitive image:
+ (if (not (eq t (mastodon-tl--property 'sensitive)))
+ (user-error "No sensitive media at point?")
+ (let ((data (mastodon-tl--property 'image-data :no-move))
+ (inhibit-read-only t)
+ (end (next-single-property-change (point) 'sensitive-state)))
+ (if (equal 'hidden (mastodon-tl--property 'sensitive-state :no-move))
+ ;; display sensitive image:
+ (add-text-properties (point) end
+ `(display ,data
+ sensitive-state showing))
+ ;; hide sensitive image:
(add-text-properties (point) end
- `(display ,data
- sensitive-state showing))
- ;; hide sensitive image:
- (add-text-properties (point) end
- `( sensitive-state hidden
- display
- ,(create-image
- mastodon-media--sensitive-image-data nil t))))))
+ `( sensitive-state hidden
+ display
+ ,(create-image
+ mastodon-media--sensitive-image-data nil t)))))))
;; POLLS