From 1f2ebe94c647fef509e06e9ef6f79697ef98a356 Mon Sep 17 00:00:00 2001 From: mousebot Date: Fri, 15 Oct 2021 12:57:41 +0200 Subject: first test merge of hdurer's WIP: Posting of images --- lisp/mastodon-media.el | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lisp/mastodon-media.el') diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index 8aadf0a..fd2a6b7 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -51,6 +51,11 @@ :group 'mastodon-media :type 'integer) +(defcustom mastodon-media--attachment-height 100 + "Height of the attached images preview." + :group 'mastodon-media + :type 'integer) + (defvar mastodon-media--generic-avatar-data (base64-decode-string "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA -- cgit v1.2.3 From 46a2f82edf61b370aa5e8432a4f3f17614293e25 Mon Sep 17 00:00:00 2001 From: mousebot Date: Fri, 15 Oct 2021 15:27:22 +0200 Subject: disambiguate media--attachment-height and preview-max-height --- lisp/mastodon-media.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lisp/mastodon-media.el') diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index fd2a6b7..28fbd19 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -47,12 +47,12 @@ :type 'integer) (defcustom mastodon-media--preview-max-height 250 - "Max height of any media attachment preview to be shown." + "Max height of any media attachment preview to be shown in timelines." :group 'mastodon-media :type 'integer) -(defcustom mastodon-media--attachment-height 100 - "Height of the attached images preview." +(defcustom mastodon-media--attachment-height 80 + "Height of the attached images preview in the toot draft buffer." :group 'mastodon-media :type 'integer) -- cgit v1.2.3 From 7bcf78751c7e0f8ac6d5ad03be8e87e8ed30f9a3 Mon Sep 17 00:00:00 2001 From: mousebot Date: Mon, 18 Oct 2021 20:54:03 +0200 Subject: Revert "handle cached images" -- caching images with url.el locks up mastodon.el This reverts commit 0129bcf466a4913bdda095b977cd06560c406a30. --- lisp/mastodon-media.el | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'lisp/mastodon-media.el') diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index 8ef9c44..b58eab6 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -189,15 +189,9 @@ REGION-LENGTH is the range from start to propertize." (condition-case nil ;; catch any errors in url-retrieve so as to not abort ;; whatever called us - (if (url-is-cached url) - (with-current-buffer (url-fetch-from-cache url) - (set-buffer-multibyte nil) - (goto-char (point-min)) - (zlib-decompress-region (goto-char (search-forward "\n\n")) (point-max)) - (mastodon-media--process-image-response nil marker image-options region-length)) - (url-retrieve url - #'mastodon-media--process-image-response - (list marker image-options region-length))) + (url-retrieve url + #'mastodon-media--process-image-response + (list marker image-options region-length)) (error (with-current-buffer buffer ;; TODO: Consider adding retries (put-text-property marker @@ -205,7 +199,7 @@ REGION-LENGTH is the range from start to propertize." 'media-state 'loading-failed) :loading-failed)))))) -H + (defun mastodon-media--select-next-media-line (end-pos) "Find coordinates of the next media to load before END-POS. -- cgit v1.2.3 From b74f24d483d3f7a478fc93eae21aa8c1e6154e24 Mon Sep 17 00:00:00 2001 From: mousebot Date: Wed, 20 Oct 2021 15:16:21 +0200 Subject: revert leftover caching things from merging image-previews branch --- lisp/mastodon-media.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lisp/mastodon-media.el') diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index 3016d33..a401de5 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -135,7 +135,7 @@ fKRJkmVZjAQwh78A6vCRWJE8K+8AAAAASUVORK5CYII=") "The PNG data for a generic 200x200 'broken image' view.") (defun mastodon-media--process-image-response - (status-plist marker image-options region-length url) + (status-plist marker image-options region-length) "Callback function processing the url retrieve response for URL. STATUS-PLIST is the usual plist of status events as per `url-retrieve'. @@ -156,8 +156,6 @@ REGION-LENGTH is the length of the region that should be replaced with the image (when image-options 'imagemagick) nil) ; inbuilt scaling in 27.1 t image-options)))) - (unless (url-is-cached url) ; cache image 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)) -- cgit v1.2.3