From a131a846daaf82061cff37f42ed16445dcdbe36a Mon Sep 17 00:00:00 2001 From: mousebot Date: Fri, 22 Oct 2021 23:50:06 +0200 Subject: move defcustom attachment-height from media to toot - this makes the autoload fun mastodon-toot have access to the variable, so that it can be successfully called without mastodon-mode having been enabled previously. - maybe there is another work around for making variables available to autoloaded functions, but i failed to find it! --- lisp/mastodon-media.el | 5 ----- lisp/mastodon-toot.el | 11 +++++++---- 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'lisp') diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index a401de5..1b6d054 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -51,11 +51,6 @@ :group 'mastodon-media :type 'integer) -(defcustom mastodon-media--attachment-height 80 - "Height of the attached images preview in the toot draft buffer." - :group 'mastodon-media - :type 'integer) - (defvar mastodon-media--generic-avatar-data (base64-decode-string "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 0153c9b..cfc5182 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -29,9 +29,6 @@ ;;; Code: -(defvar mastodon-instance-url) -(defvar mastodon-media--attachment-height) -(defvar mastodon-toot--enable-completion-for-mentions) (when (require 'emojify nil :noerror) (declare-function emojify-insert-emoji "emojify")) @@ -39,6 +36,7 @@ (require 'cl-lib) (require 'company nil :noerror) +(defvar mastodon-instance-url) (autoload 'mastodon-auth--user-acct "mastodon-auth") (autoload 'mastodon-http--api "mastodon-http") (autoload 'mastodon-http--post "mastodon-http") @@ -81,6 +79,11 @@ Must be one of \"public\", \"unlisted\", \"private\" (for followers-only), or \" :group 'mastodon-toot :type 'string) +(defcustom mastodon-toot--attachment-height 80 + "Height of the attached images preview in the toot draft buffer." + :group 'mastodon-media + :type 'integer) + (when (require 'company nil :noerror) (defcustom mastodon-toot--enable-completion-for-mentions "followers" "Whether to enable company completion for mentions in toot compose buffer." @@ -584,7 +587,7 @@ It adds the items' ids to `mastodon-toot--media-attachment-ids', which is used t (or (let ((counter 0) (image-options (when (or (image-type-available-p 'imagemagick) (image-transforms-p)) - `(:height ,mastodon-media--attachment-height)))) + `(:height ,mastodon-toot--attachment-height)))) (mapcan (lambda (attachment) (let* ((data (cdr (assoc :contents attachment))) (image (apply #'create-image data -- cgit v1.2.3