diff options
-rw-r--r-- | lisp/mastodon-search.el | 2 | ||||
-rw-r--r-- | lisp/mastodon-tl.el | 14 | ||||
-rw-r--r-- | lisp/mastodon-toot.el | 24 | ||||
-rw-r--r-- | lisp/mastodon-views.el | 8 |
4 files changed, 39 insertions, 9 deletions
diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el index ac32efb..d73bf9f 100644 --- a/lisp/mastodon-search.el +++ b/lisp/mastodon-search.el @@ -234,7 +234,7 @@ BUFFER, PARAMS, and UPDATE-FUN are for `mastodon-tl--buffer-spec'." ((equal type "statuses") (mastodon-search--query query "hashtags"))))) -(defun mastodon-serach--query-accounts-followed (query) +(defun mastodon-search--query-accounts-followed (query) "Run an accounts search QUERY, limited to your followers." (interactive "sSearch mastodon for: ") (mastodon-search--query query "accounts" :following)) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 561087e..3d8e8dd 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -190,6 +190,11 @@ re-load mastodon.el, or restart Emacs." :type '(choice (const :tag "true" t) (const :tag "false" nil) (const :tag "follow server setting" server))) + +(defcustom mastodon-tl--tag-timeline-tags nil + "A list of up to four tags for use with `mastodon-tl--followed-tags-timeline'." + :type '(repeat string)) + ;;; VARIABLES @@ -2206,13 +2211,14 @@ PREFIX is sent to `mastodon-tl--get-tag-timeline', which see." (mastodon-tl--get-tag-timeline prefix tag)))) (defun mastodon-tl--followed-tags-timeline (&optional prefix) - "Open a timeline of all your followed tags. + "Open a timeline of multiple tags. PREFIX is sent to `mastodon-tl--show-tag-timeline', which see. -Note that the number of tags supported is undocumented, and from -manual testing appears to be limited to a total of four tags." +If `mastodon-tl--tag-timeline-tags' is set, use its tags, else +fetch followed tags and load the first four of them." (interactive "p") (let* ((followed-tags-json (mastodon-tl--followed-tags)) - (tags (mastodon-tl--map-alist 'name followed-tags-json))) + (tags (or mastodon-tl--tag-timeline-tags + (mastodon-tl--map-alist 'name followed-tags-json)))) (mastodon-tl--show-tag-timeline prefix tags))) (defun mastodon-tl--some-followed-tags-timeline (&optional prefix) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index f60f314..6febec7 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -1225,6 +1225,30 @@ File is actually attached to the toot upon posting." (mastodon-toot--upload-attached-media (car (last mastodon-toot--media-attachments))))) +(defun mastodon-toot--attachment-descriptions () + "Return a list of image descriptions for current attachments." + (mapcar (lambda (a) + (alist-get :description a)) + mastodon-toot--media-attachments)) + +(defun mastodon-toot--attachment-from-desc (desc) + "Return an attachment based on its description DESC." + (car + (cl-member-if (lambda (x) + (rassoc desc x)) + mastodon-toot--media-attachments))) + +(defun mastodon-toot--edit-media-description () + "Prompt for an attachment, and update its description." + (interactive) + (let* ((descs (mastodon-toot--attachment-descriptions)) + (choice (completing-read "Attachment: " descs nil :match)) + (attachment (mastodon-toot--attachment-from-desc choice)) + (desc-new (read-string "Description: " choice))) + (setf (alist-get :description attachment) + desc-new) + (mastodon-toot--refresh-attachments-display))) + (defun mastodon-toot--upload-attached-media (attachment) "Upload a single ATTACHMENT using `mastodon-http--post-media-attachment'. The item's id is added to `mastodon-toot--media-attachment-ids', diff --git a/lisp/mastodon-views.el b/lisp/mastodon-views.el index 28f7c7c..8e04434 100644 --- a/lisp/mastodon-views.el +++ b/lisp/mastodon-views.el @@ -572,14 +572,14 @@ NO-CONFIRM means there is no ask or message, there is only do." (let* ((toot (mastodon-tl--property 'scheduled-json :no-move)) (scheduled (alist-get 'scheduled_at toot))) (let-alist (alist-get 'params toot) + ;; TODO: preserve polls ;; (poll (alist-get 'poll params)) - ;; (media (alist-get 'media_attachments toot))) - (mastodon-toot--compose-buffer) + (mastodon-toot--compose-buffer nil .in_reply_to_id nil .text :edit) (goto-char (point-max)) - (insert .text) ;; adopt properties from scheduled toot: (mastodon-toot--set-toot-properties - .in_reply_to_id .visibility .spoiler_text .language scheduled id)))))) + .in_reply_to_id .visibility .spoiler_text .language + scheduled id (alist-get 'media_attachments toot))))))) ;;; FILTERS |