diff options
-rw-r--r-- | lisp/mastodon-media.el | 8 | ||||
-rw-r--r-- | lisp/mastodon-tl.el | 14 | ||||
-rw-r--r-- | lisp/mastodon-toot.el | 3 |
3 files changed, 12 insertions, 13 deletions
diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index 8c035be..570be02 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -363,15 +363,14 @@ 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) - (image-transforms-p)) ; inbuilt scaling in 27.1 + (when (mastodon-tl--image-trans-check) (cond ((eq media-type 'avatar) `(:height ,mastodon-media--avatar-height)) ((eq media-type 'media-link) `(:max-height ,mastodon-media--preview-max-height))))) (buffer (current-buffer)) (marker (copy-marker start)) - (url-show-status nil)) ; stop url.el from spamming us about connecting + (url-show-status nil)) ; stop url.el from spamming us about connecting (condition-case nil ;; catch errors in url-retrieve to not break our caller (if (and mastodon-media--enable-image-caching @@ -469,8 +468,7 @@ START and END are the beginning and end of the media item to overlay." ;; We use just an empty space as the textual representation. ;; This is what a user will see on a non-graphical display ;; where not showing an avatar at all is preferable. - (let ((image-options (when (or (image-type-available-p 'imagemagick) - (image-transforms-p)) ; inbuilt scaling in 27.1 + (let ((image-options (when (mastodon-tl--image-trans-check) `(:height ,mastodon-media--avatar-height)))) (concat (propertize " " diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 80c1e42..0c9670b 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -591,9 +591,7 @@ When DOMAIN, force inclusion of user's domain in their handle." (when (and avatar ; used by `mastodon-profile--format-user' mastodon-tl--show-avatars mastodon-tl--display-media-p - (if (version< emacs-version "27.1") - (image-type-available-p 'imagemagick) - (image-transforms-p))) + (mastodon-tl--image-trans-check)) (mastodon-media--get-avatar-rendering .account.avatar)) ;; username: (propertize (if (not (string-empty-p .account.display_name)) @@ -696,6 +694,12 @@ LETTER is a string, F for favourited, B for boosted, or K for bookmarked." 'help-echo (format "You have %s this status." help-string))))) +(defun mastodon-tl--image-trans-check () + "Call `image-transforms-p', or `image-type-available-p' 'imagemagick." + (if (version< emacs-version "27.1") + (image-type-available-p 'imagemagick) + (image-transforms-p))) + (defun mastodon-tl--byline (toot author-byline action-byline &optional detailed-p domain base-toot) "Generate byline for TOOT. @@ -748,9 +752,7 @@ When DOMAIN, force inclusion of user's domain in their handle." ;; with `mastodon-tl--goto-next-item': (when (and mastodon-tl--show-avatars mastodon-tl--display-media-p - (if (version< emacs-version "27.1") - (image-type-available-p 'imagemagick) - (image-transforms-p))) + (mastodon-tl--image-trans-check)) (mastodon-media--get-avatar-rendering avatar-url)) (propertize (concat diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 2232cc8..7c5472b 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -1329,8 +1329,7 @@ which is used to attach it to a toot when posting." (defun mastodon-toot--format-attachments () "Format the attachment previews for display in toot draft buffer." (or - (let ((image-options (when (or (image-type-available-p 'imagemagick) - (image-transforms-p)) + (let ((image-options (when (mastodon-tl--image-trans-check) `(:height ,mastodon-toot--attachment-height)))) (cl-loop for count from 1 for att in mastodon-toot--media-attachments |