From 7bcc81748d5a7c2ef4b6460500a9eb1ea3ddca18 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sun, 8 Oct 2023 09:36:48 +0200 Subject: refactor toot-url and copy-toot-url --- lisp/mastodon-toot.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'lisp') diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index f46fc6d..f819a16 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -507,14 +507,18 @@ With FAVOURITE, list favouriters, else list boosters." If the toot is a fave/boost notification, copy the URL of the base toot." (interactive) - (let* ((toot (or (mastodon-tl--property 'base-toot) - (mastodon-tl--property 'toot-json))) - (url (if (mastodon-tl--field 'reblog toot) - (alist-get 'url (alist-get 'reblog toot)) - (alist-get 'url toot)))) + (let* ((url (mastodon-toot--toot-url))) (kill-new url) (message "Toot URL copied to the clipboard."))) +(defun mastodon-toot--toot-url () + "Return the URL of the base toot at point." + (let* ((toot (or (mastodon-tl--property 'base-toot) + (mastodon-tl--property 'toot-json)))) + (if (mastodon-tl--field 'reblog toot) + (alist-get 'url (alist-get 'reblog toot)) + (alist-get 'url toot)))) + (defun mastodon-toot--copy-toot-text () "Copy text of toot at point. If the toot is a fave/boost notification, copy the text of the -- cgit v1.2.3