aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-media.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2023-08-27 22:33:13 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2023-08-27 22:33:13 -0400
commit126e2d8642669d3bc3f16d8a163dc9f0e0325a07 (patch)
treea731306b8049300df2ac0c4c4333c3aeee52d24c /lisp/mastodon-media.el
parentb54fc1b6d405024c2b5c6019e60ee7ed0744b66c (diff)
Fix "empty body" warnings
* lisp/mastodon-media.el (mastodon-media--process-image-response): Remove unused `unwind-protect`. * lisp/mastodon-views.el (mastodon-views--delete-filter): Fix paren error which made a `y-or-n-p` ineffective.
Diffstat (limited to 'lisp/mastodon-media.el')
-rw-r--r--lisp/mastodon-media.el61
1 files changed, 30 insertions, 31 deletions
diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el
index 5cd233a..04cf0c2 100644
--- a/lisp/mastodon-media.el
+++ b/lisp/mastodon-media.el
@@ -148,40 +148,39 @@ with the image."
(when (marker-buffer marker) ; if buffer hasn't been killed
(let ((url-buffer (current-buffer))
(is-error-response-p (eq :error (car status-plist))))
- (unwind-protect
- (let* ((data (unless is-error-response-p
- (goto-char (point-min))
- (search-forward "\n\n")
- (buffer-substring (point) (point-max))))
- (image (when data
- (apply #'create-image data
- (if (version< emacs-version "27.1")
- (when image-options 'imagemagick)
- nil) ; inbuilt scaling in 27.1
- t image-options))))
- (when mastodon-media--enable-image-caching
- (unless (url-is-cached url) ; cache if not already cached
- (url-store-in-cache url-buffer)))
- (with-current-buffer (marker-buffer marker)
- ;; Save narrowing in our buffer
- (let ((inhibit-read-only t))
- (save-restriction
- (widen)
- (put-text-property marker
- (+ marker region-length) 'media-state 'loaded)
- (when image
- ;; We only set the image to display if we could load
- ;; it; we already have set a default image when we
- ;; added the tag.
- (put-text-property marker (+ marker region-length)
- 'display image))
- ;; We are done with the marker; release it:
- (set-marker marker nil)))
- (kill-buffer url-buffer)))))))
+ (let* ((data (unless is-error-response-p
+ (goto-char (point-min))
+ (search-forward "\n\n")
+ (buffer-substring (point) (point-max))))
+ (image (when data
+ (apply #'create-image data
+ (if (version< emacs-version "27.1")
+ (when image-options 'imagemagick)
+ nil) ; inbuilt scaling in 27.1
+ t image-options))))
+ (when mastodon-media--enable-image-caching
+ (unless (url-is-cached url) ; cache if not already cached
+ (url-store-in-cache url-buffer)))
+ (with-current-buffer (marker-buffer marker)
+ ;; Save narrowing in our buffer
+ (let ((inhibit-read-only t))
+ (save-restriction
+ (widen)
+ (put-text-property marker
+ (+ marker region-length) 'media-state 'loaded)
+ (when image
+ ;; We only set the image to display if we could load
+ ;; it; we already have set a default image when we
+ ;; added the tag.
+ (put-text-property marker (+ marker region-length)
+ 'display image))
+ ;; We are done with the marker; release it:
+ (set-marker marker nil)))
+ (kill-buffer url-buffer))))))
(defun mastodon-media--load-image-from-url (url media-type start region-length)
"Take a URL and MEDIA-TYPE and load the image asynchronously.
-MEDIA-TYPE is a symbol and either `avatar' or `media-link.'
+MEDIA-TYPE is a symbol and either `avatar' or `media-link'.
START is the position where we start loading the image.
REGION-LENGTH is the range from start to propertize."
(let ((image-options (when (or (image-type-available-p 'imagemagick)