aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2021-10-15 13:13:38 +0200
committermousebot <mousebot@riseup.net>2021-10-15 13:15:26 +0200
commit72c14d797fe3848429b64812fb7145d11253fc88 (patch)
tree35aa5543a09367ce068df959353cc3f46cb1a2b2 /lisp
parent1f2ebe94c647fef509e06e9ef6f79697ef98a356 (diff)
handle image scaling with image-transforms-p (when emacs >= 27.1)
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-toot.el13
1 files changed, 8 insertions, 5 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 6c08859..1afad8a 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -477,12 +477,15 @@ eg. \"feduser@fed.social\" -> \"feduser@fed.social\"."
(defun mastodon-toot--format-attachments ()
(or (let ((counter 0)
- (image-options (when (image-type-available-p 'imagemagick)
+ (image-options (when (or (image-type-available-p 'imagemagick)
+ (image-transforms-p))
`(:height ,mastodon-media--attachment-height))))
(mapcan (lambda (attachment)
(let* ((data (cdr (assoc :contents attachment)))
(image (apply #'create-image data
- (when image-options 'imagemagick)
+ (if (version< emacs-version "27.1")
+ (when image-options 'imagemagick)
+ nil) ; inbuilt scaling in 27.1
t image-options))
(type (cdr (assoc :content-type attachment)))
(description (cdr (assoc :description attachment))))
@@ -491,8 +494,8 @@ eg. \"feduser@fed.social\" -> \"feduser@fed.social\"."
image
(format " \"%s\" (%s)" description type))))
mastodon-toot--media-attachments))
- (list "None"))
- )
+ (list "None")))
+
;; we'll need to revisit this if the binds get
;; more diverse than two-chord bindings
(defun mastodon-toot--get-mode-kbinds ()
@@ -596,7 +599,7 @@ If REPLY-TO-ID is provided, set the MASTODON-TOOT--REPLY-TO-ID var."
(point-min))))
(add-text-properties (car count-region) (cdr count-region)
(list 'display
- (format "%s characters in message"
+ (format "%s characters"
(- (point-max) (cdr header-region)))))
(add-text-properties (car visibility-region) (cdr visibility-region)
(list 'display