diff options
author | marty hiatt <martianhiatus@riseup.net> | 2024-01-22 11:16:41 +0100 |
---|---|---|
committer | marty hiatt <martianhiatus@riseup.net> | 2024-01-22 11:16:41 +0100 |
commit | 9ffe93009cbcf40a4b0aab103c8bcd98bb291ba7 (patch) | |
tree | 649d8beac3c6c5f277802d285a23aab4ec70267f /lisp | |
parent | 38f9437ad99db8a94f64e721f80294c54d7b7ecb (diff) |
edit attachments description fun
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mastodon-toot.el | 24 |
1 files changed, 24 insertions, 0 deletions
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', |