aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus@riseup.net>2023-11-06 11:52:30 +0100
committermarty hiatt <martianhiatus@riseup.net>2023-11-06 11:52:30 +0100
commit1da8ab0675928f84790bd684db28d0b7ee14dab8 (patch)
treed427d859ce697b7b0dbc7c0b32df7b33c4961f7b /lisp
parentd9959ace123b7beb19252819e9b8d92286d40384 (diff)
add cmd to url-lookup with no fedi-like check
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon.el10
1 files changed, 8 insertions, 2 deletions
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