diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2022-11-11 12:35:56 +0100 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2022-11-11 12:35:56 +0100 |
commit | 16f8c9c6e21bbe55d6c40099dab5253e4a165354 (patch) | |
tree | fe5d0c45a0abd18ee92be1dc88b8bcfe43ce506d /lisp | |
parent | bbfd03e8d6c6ecc9cd80dd73025f1176db02d2a0 (diff) |
do-link-action optional url lookup if search can't find account
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mastodon-tl.el | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 93f2d0f..b0baa70 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -801,8 +801,7 @@ Used for hitting <return> on a given link." (mastodon-tl--toggle-spoiler-text position)) ((eq link-type 'hashtag) (mastodon-tl--show-tag-timeline (get-text-property position 'mastodon-tag))) - ;; FIXME: 'account / 'account-id is not set for mentions - ;; only works for bylines, not mentions + ;; 'account / 'account-id is not set for mentions, only bylines ((eq link-type 'user-handle) (let ((account-json (get-text-property position 'account)) (account-id (get-text-property position 'account-id))) @@ -814,9 +813,17 @@ Used for hitting <return> on a given link." (mastodon-profile--make-author-buffer (mastodon-profile--account-from-id account-id))) (t - (mastodon-profile--make-author-buffer - (mastodon-profile--search-account-by-handle - (get-text-property position 'mastodon-handle))))))) + (let ((account + (mastodon-profile--search-account-by-handle + (get-text-property position 'mastodon-handle)))) + ;; never call make-author-buffer on nil account: + (if account + (mastodon-profile--make-author-buffer account) + ;; optional webfinger lookup: + (if (y-or-n-p + "Search for account returned nothing. Perform URL lookup?") + (mastodon-url-lookup (get-text-property position 'shr-url)) + (message "Unable to find account.")))))))) (t (error "Unknown link type %s" link-type))))) |