diff options
author | mousebot <mousebot@riseup.net> | 2021-09-13 20:14:28 +0200 |
---|---|---|
committer | mousebot <mousebot@riseup.net> | 2021-09-13 21:33:16 +0200 |
commit | 14842fce7caa96c0f6234308c85a82a8e556f18f (patch) | |
tree | cdea0397fd69028a6e099f8438f76985b86048df /lisp | |
parent | 99a69f0cb267dcc22e3e1476f0e9f8d6dc46faa7 (diff) |
use inbuilt image scaling if emacs version => 27.1
and put point at point-min on profile load
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mastodon-media.el | 17 | ||||
-rw-r--r-- | lisp/mastodon-profile.el | 3 | ||||
-rw-r--r-- | lisp/mastodon-tl.el | 4 |
3 files changed, 17 insertions, 7 deletions
diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index 381d994..2100553 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -41,7 +41,7 @@ :prefix "mastodon-media-" :group 'mastodon) -(defcustom mastodon-media--avatar-height 30 +(defcustom mastodon-media--avatar-height 20 "Height of the user avatar images (if shown)." :group 'mastodon-media :type 'integer) @@ -146,7 +146,10 @@ REGION-LENGTH is the length of the region that should be replaced with the image (search-forward "\n\n") (buffer-substring (point) (point-max)))) (image (when data - (apply #'create-image data (when image-options 'imagemagick) + (apply #'create-image data + (if (version< emacs-version "27.1") + (when image-options 'imagemagick) + nil) ; inbuilt scaling in 27.1 t image-options)))) (with-current-buffer (marker-buffer marker) ;; Save narrowing in our buffer @@ -170,7 +173,8 @@ REGION-LENGTH is the length of the region that should be replaced with the image MEDIA-TYPE is a symbol and either 'avatar or 'media-link." ;; TODO: Cache the avatars - (let ((image-options (when (image-type-available-p 'imagemagick) + (let ((image-options (when (or (image-type-available-p 'imagemagick) + (image-transforms-p)) ; inbuilt scaling in 27.1 (cond ((eq media-type 'avatar) `(:height ,mastodon-media--avatar-height)) @@ -251,7 +255,8 @@ replacing them with the referenced image." ;; 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 (image-type-available-p 'imagemagick) + (let ((image-options (when (or (image-type-available-p 'imagemagick) + (image-transforms-p)) ; inbuilt scaling in 27.1 `(:height ,mastodon-media--avatar-height)))) (concat (propertize " " @@ -259,7 +264,9 @@ replacing them with the referenced image." 'media-state 'needs-loading 'media-type 'avatar 'display (apply #'create-image mastodon-media--generic-avatar-data - (when image-options 'imagemagick) + (if (version< emacs-version "27.1") + (when image-options 'imagemagick) + nil) ; inbuilt scaling in 27.1 t image-options)) " "))) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 82eb4db..eb75247 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -372,7 +372,8 @@ Returns a list of lists." (if (and pinned (equal endpoint-type "statuses")) (mastodon-profile--insert-statuses-pinned pinned)) (funcall update-function json))) - (mastodon-tl--goto-next-toot))) + ;;(mastodon-tl--goto-next-toot) + (goto-char (point-min)))) (defun mastodon-profile--get-toot-author () "Open profile of author of toot under point. diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index d34371a..a6f3f9a 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -83,7 +83,9 @@ width fonts when rendering HTML text")) (make-variable-buffer-local 'mastodon-tl--buffer-spec) (defvar mastodon-tl--show-avatars-p - (image-type-available-p 'imagemagick) + (if (version< emacs-version "27.1") + (image-type-available-p 'imagemagick) + (image-transforms-p)) "A boolean value stating whether to show avatars in timelines.") (defvar mastodon-tl--update-point nil |