aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-01-28 09:51:26 +0100
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-01-28 09:51:26 +0100
commit883a13c272092d66389df0da635869056bfb88e4 (patch)
tree12c5f005ab69c4055999bcfa57956998d628e159
parent3998bfa01b4a3998288061ab87d5c4f4c7ffdf3d (diff)
add account of toot at point to any list. FIXES #380
-rw-r--r--lisp/mastodon-tl.el16
1 files changed, 14 insertions, 2 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 7fe1c02..9864819 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -1938,9 +1938,12 @@ a: add account to this list, r: remove account from this list"
If ID is provided, use that list.
If ACCOUNT-ID and HANDLE are provided use them rather than prompting."
(interactive)
- (let* ((list-name (if id
+ (let* ((list-prompt (if handle
+ (format "Add %s to list: " handle)
+ "Add account to list: "))
+ (list-name (if id
(get-text-property (point) 'list-name)
- (completing-read "Add account to list: "
+ (completing-read list-prompt
(mastodon-tl--get-lists-names) nil t)))
(list-id (or id (mastodon-tl--get-list-id list-name)))
(followings (mastodon-tl--get-users-followings))
@@ -1958,6 +1961,15 @@ If ACCOUNT-ID and HANDLE are provided use them rather than prompting."
response
(message "%s added to list %s!" account list-name))))
+(defun mastodon-tl--add-toot-account-at-point-to-list ()
+ "Prompt for a list, and add the account of the toot at point to it."
+ (interactive)
+ (let* ((toot (mastodon-tl--property 'toot-json))
+ (account (mastodon-tl--field 'account toot))
+ (account-id (mastodon-tl--field 'id account))
+ (handle (mastodon-tl--field 'acct account)))
+ (mastodon-tl--add-account-to-list nil account-id handle)))
+
(defun mastodon-tl--remove-account-from-list-at-point ()
"Prompt for account and remove from list at point."
(interactive)