diff options
author | mousebot <mousebot@riseup.net> | 2021-10-29 11:18:04 +0200 |
---|---|---|
committer | mousebot <mousebot@riseup.net> | 2021-10-29 11:18:04 +0200 |
commit | fa00c8dd2d0cc65d58298667e18023e23980ed58 (patch) | |
tree | 219651faaaccda7d071da6ec85514e2daf57e6c0 /lisp/mastodon-media.el | |
parent | bceb7286a70dc90680bca4a9703db5d847b1e920 (diff) |
enable-image-caching customize option
Diffstat (limited to 'lisp/mastodon-media.el')
-rw-r--r-- | lisp/mastodon-media.el | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index fcef218..808a23d 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -51,6 +51,11 @@ :group 'mastodon-media :type 'integer) +(defcustom mastodon-media--enable-image-caching nil + "Whether images should be cached." + :group 'mastodon-media + :type 'boolean) + (defvar mastodon-media--generic-avatar-data (base64-decode-string "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA @@ -151,8 +156,9 @@ 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)) + (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)) @@ -191,7 +197,8 @@ 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) + (if (and mastodon-media--enable-image-caching + (url-is-cached url)) ;; if image url is cached, decompress and use it (with-current-buffer (url-fetch-from-cache url) (set-buffer-multibyte nil) |