From acbd904683f68b7720af6fe766ab0ec98352a350 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 5 Sep 2022 13:57:36 +0200 Subject: customize option to display orig toot when replying --- lisp/mastodon.el | 1 + 1 file changed, 1 insertion(+) (limited to 'lisp/mastodon.el') diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 0c6104f..64aefc0 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -33,6 +33,7 @@ ;;; Code: (require 'cl-lib) ; for `cl-some' call in mastodon +(eval-when-compile (require 'subr-x)) (require 'mastodon-http) (require 'mastodon-toot) -- cgit v1.2.3 From bb257ae3cc0feae1f7bf8be03c1abf35800ce962 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 10 Sep 2022 18:14:44 +0200 Subject: autoloads/requires/mode hook in mastodon.el --- lisp/mastodon.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lisp/mastodon.el') diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 64aefc0..5e95b35 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -36,6 +36,7 @@ (eval-when-compile (require 'subr-x)) (require 'mastodon-http) (require 'mastodon-toot) +(require 'url) (declare-function discover-add-context-menu "discover") (declare-function emojify-mode "emojify") @@ -95,6 +96,7 @@ (when (require 'lingva nil :no-error) (autoload 'mastodon-toot--translate-toot-text "mastodon-toot")) (autoload 'mastodon-search--trending-tags "mastodon-search") +(autoload 'mastodon-profile-fetch-server-account-settings "mastodon-profile") (defgroup mastodon nil "Interface with Mastodon." @@ -303,8 +305,6 @@ not, just browse the URL in the normal fashion." (defun mastodon--masto-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 - ;; TODO: remove domain and add ^ to regex: - ;; (let ((query-path (url-file-nondirectory query))) (let* ((uri-parsed (url-generic-parse-url query)) (query (url-filename uri-parsed))) (save-match-data @@ -325,6 +325,9 @@ not, just browse the URL in the normal fashion." (when mastodon-toot--enable-custom-instance-emoji (mastodon-toot--enable-custom-emoji))))) +;;;###autoload +(add-hook 'mastodon-mode-hook #'mastodon-profile-fetch-server-account-settings) + (define-derived-mode mastodon-mode special-mode "Mastodon" "Major mode for Mastodon, the federated microblogging network." :group 'mastodon -- cgit v1.2.3 From 083b504626fa3540cc7e88a8288b30b9ee7292bc Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 12 Sep 2022 14:06:59 +0200 Subject: improve masto-url-p regexes for users --- lisp/mastodon.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lisp/mastodon.el') diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 5e95b35..969ab36 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -305,10 +305,12 @@ not, just browse the URL in the normal fashion." (defun mastodon--masto-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 + ;; thx to Conny Duck! (let* ((uri-parsed (url-generic-parse-url query)) (query (url-filename uri-parsed))) (save-match-data - (or (string-match "^/@[[:alnum:]]+/[[:digit:]]+$" query) + (or (string-match "^/@[^/]+$" query) + (string-match "^/@[^/]+/[[:digit:]]+$" query) (string-match "^/users/[[:alnum:]]+$" query) (string-match "^/notice/[[:alnum:]]+$" query) (string-match "^/objects/[-a-f0-9]+$" query) -- cgit v1.2.3 From 3e404cb392cab584bdf1f73d099ae0dd1c25708f Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 12 Sep 2022 14:56:33 +0200 Subject: url-lookup: shr-browse-url in masto-mode, otherwise browse-url --- lisp/mastodon.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lisp/mastodon.el') diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 969ab36..72043cf 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -283,7 +283,9 @@ not, just browse the URL in the normal fashion." (get-text-property (point) 'shr-url) (read-string "Lookup URL: ")))) (if (not (mastodon--masto-url-p query)) - (browse-url query) + (if (equal major-mode 'mastodon-mode) + (shr-browse-url query) ;; keep our shr keymap + (browse-url query)) (message "Performing lookup...") (let* ((url (format "%s/api/v2/search" mastodon-instance-url)) (param (concat "resolve=t")) ; webfinger -- cgit v1.2.3