From 869917a0e770449040a6fbc15a80365fe6c86bdf Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 12 Oct 2023 18:06:26 +0200 Subject: rough account statuses search --- lisp/mastodon-profile.el | 8 ++++++++ lisp/mastodon-search.el | 2 ++ 2 files changed, 10 insertions(+) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index a05087f..bee1b26 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -93,6 +93,7 @@ (defvar mastodon-profile-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "C-c C-c") #'mastodon-profile--account-view-cycle) + (define-key map (kbd "C-c C-s") #'mastodon-profile--account-search) map) "Keymap for `mastodon-profile-mode'.") @@ -215,6 +216,13 @@ NO-REBLOGS means do not display boosts in statuses." (handle (alist-get 'acct profile))) (mastodon-views--add-account-to-list nil id handle)))) +(defun mastodon-profile--account-search (query) + "Search currently viewed account for QUERY." + (interactive "sSearch account for: ") + (let* ((ep (mastodon-tl--buffer-property 'endpoint)) + (id (nth 1 (split-string ep "/")))) + (mastodon-search--search-query query "statuses" nil id))) + ;;; ACCOUNT PREFERENCES diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el index e2faec5..a9c3b90 100644 --- a/lisp/mastodon-search.el +++ b/lisp/mastodon-search.el @@ -147,6 +147,8 @@ PRINT-FUN is the function used to print the data from the response." (defun mastodon-search--search-query (query &optional type following account-id) "Prompt for a search QUERY and return accounts, statuses, and hashtags." + ;; TODO: handle account search, buffer name etc. + ;; TODO: handle no results (interactive "sSearch mastodon for: ") (let* ((url (format "%s/api/v2/search" mastodon-instance-url)) (type (or type -- cgit v1.2.3