From 1da8ab0675928f84790bd684db28d0b7ee14dab8 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 6 Nov 2023 11:52:30 +0100 Subject: add cmd to url-lookup with no fedi-like check --- lisp/mastodon.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lisp/mastodon.el') diff --git a/lisp/mastodon.el b/lisp/mastodon.el index bb06d1b..6e05bd8 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -341,7 +341,7 @@ from the server and load anew." ;; URL lookup: should be available even if `mastodon.el' not loaded: ;;;###autoload -(defun mastodon-url-lookup (&optional query-url) +(defun mastodon-url-lookup (&optional query-url force) "If a URL resembles a mastodon link, try to load in `mastodon.el'. Does a WebFinger lookup. URL can be arg QUERY-URL, or URL at point, or provided by the user. @@ -352,7 +352,8 @@ not, just browse the URL in the normal fashion." (thing-at-point-url-at-point) (mastodon-tl--property 'shr-url :no-move) (read-string "Lookup URL: ")))) - (if (not (mastodon--fedi-url-p query)) + (if (and (not force) + (not (mastodon--fedi-url-p query))) ;; (shr-browse-url query) ; doesn't work (keep our shr keymap) (browse-url query) (message "Performing lookup...") @@ -374,6 +375,11 @@ not, just browse the URL in the normal fashion." (t (browse-url query))))))) +(defun mastodon-url-lookup-force () + "Call `mastodon-url-lookup' without checking if URL is fedi-like." + (interactive) + (mastodon-url-lookup nil :force)) + (defun mastodon--fedi-url-p (query) "Check if QUERY resembles a fediverse URL." ;; calqued off https://github.com/tuskyapp/Tusky/blob/c8fc2418b8f5458a817bba221d025b822225e130/app/src/main/java/com/keylesspalace/tusky/BottomSheetActivity.kt -- cgit v1.2.3