aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/mastodon-media.el21
-rw-r--r--lisp/mastodon-tl.el23
2 files changed, 23 insertions, 21 deletions
diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el
index 8da9bb5..9827ab8 100644
--- a/lisp/mastodon-media.el
+++ b/lisp/mastodon-media.el
@@ -38,7 +38,6 @@
(require 'image-mode)
(autoload 'mastodon-tl--propertize-img-str-or-url "mastodon-tl")
-(autoload 'mastodon-tl--property "mastodon-tl")
(defvar url-show-status)
@@ -198,26 +197,6 @@ image-data prop so it can be toggled."
sensitive-state hidden
image-data ,image))))
-(defun mastodon-media--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:
- (add-text-properties (point) end
- `(display ,data
- sensitive-state showing))
- ;; hide sensitive image:
- (add-text-properties (point) end
- `( sensitive-state hidden
- display
- ;; TODO: use an image placeholder
- ,(create-image mastodon-media--generic-broken-image-data nil t)
- ;; ,(mastodon-search--format-heading " SENSITIVE")
- )))))
-
(defun mastodon-media--process-full-sized-image-response (status-plist url)
;; FIXME: refactor this with but not into
;; `mastodon-media--process-image-response'.
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 573c2fa..cf5d316 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -292,6 +292,7 @@ types of mastodon links and not just shr.el-generated ones.")
;; keep new my-profile binding; shr 'O' doesn't work here anyway
(define-key map (kbd "O") #'mastodon-profile--my-profile)
(define-key map (kbd "C") #'mastodon-tl--copy-image-caption)
+ (define-key map (kbd "C-c C-c") #'mastodon-tl--toggle-sensitive-image)
(define-key map (kbd "<C-return>") #'mastodon-tl--mpv-play-video-at-point)
(define-key map (kbd "<mouse-2>") #'mastodon-tl--click-image-or-video)
map)
@@ -1215,6 +1216,28 @@ 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:
+ (add-text-properties (point) end
+ `(display ,data
+ sensitive-state showing))
+ ;; hide sensitive image:
+ (add-text-properties (point) end
+ `( sensitive-state hidden
+ display
+ ;; TODO: use an image placeholder
+ ,(create-image mastodon-media--generic-broken-image-data nil t)
+ ;; ,(mastodon-search--format-heading " SENSITIVE")
+ )))))
+
;; POLLS