diff options
-rw-r--r-- | lisp/.dir-locals.el | 6 | ||||
-rw-r--r-- | lisp/mastodon-discover.el | 1 | ||||
-rw-r--r-- | lisp/mastodon-profile.el | 8 | ||||
-rw-r--r-- | lisp/mastodon-search.el | 2 | ||||
-rw-r--r-- | lisp/mastodon-tl.el | 19 | ||||
-rw-r--r-- | lisp/mastodon-toot.el | 29 | ||||
-rw-r--r-- | lisp/mastodon-views.el | 8 | ||||
-rw-r--r-- | lisp/mastodon.el | 2 | ||||
-rw-r--r-- | mastodon-index.org | 12 |
9 files changed, 68 insertions, 19 deletions
diff --git a/lisp/.dir-locals.el b/lisp/.dir-locals.el index 44e84e5..bcb8ba5 100644 --- a/lisp/.dir-locals.el +++ b/lisp/.dir-locals.el @@ -1,5 +1,7 @@ ;;; Directory Local Variables ;;; For more information see (info "(emacs) Directory Variables") -;; setting this makes package-lint look in the main file for deps: -((emacs-lisp-mode . ((package-lint-main-file . "mastodon.el")))) +;; Preferred indentation style: +((nil . ((indent-tabs-mode . nil))) + ;; setting this makes package-lint look in the main file for deps: + (emacs-lisp-mode . ((package-lint-main-file . "mastodon.el")))) diff --git a/lisp/mastodon-discover.el b/lisp/mastodon-discover.el index 715954f..c34d85f 100644 --- a/lisp/mastodon-discover.el +++ b/lisp/mastodon-discover.el @@ -65,6 +65,7 @@ ("t" "New toot" mastodon-toot) ("r" "Reply" mastodon-toot--reply) ("C" "Copy toot URL" mastodon-toot--copy-toot-url) + ("o" "Open toot URL" mastodon-toot--open-toot-url) ("d" "Delete (your) toot" mastodon-toot--delete-toot) ("D" "Delete and redraft (your) toot" mastodon-toot--delete-toot) ("e" "Edit (your) toot" mastodon-toot--edit-toot-at-point) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 22dd586..fc90cf7 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -777,13 +777,13 @@ If the handle does not match a search return then retun NIL." (let* ((handle (if (string= "@" (substring handle 0 1)) (substring handle 1 (length handle)) handle)) - (args `(("q" . ,handle))) + (args `(("q" . ,handle) + ("type" . "accounts"))) + (result (mastodon-http--get-json (mastodon-http--api-search) args)) (matching-account (seq-remove (lambda (x) (not (string= (alist-get 'acct x) handle))) - (mastodon-http--get-json - (mastodon-http--api "accounts/search") - args)))) + (alist-get 'accounts result)))) (when (equal 1 (length matching-account)) (elt matching-account 0)))) diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el index ac32efb..d73bf9f 100644 --- a/lisp/mastodon-search.el +++ b/lisp/mastodon-search.el @@ -234,7 +234,7 @@ BUFFER, PARAMS, and UPDATE-FUN are for `mastodon-tl--buffer-spec'." ((equal type "statuses") (mastodon-search--query query "hashtags"))))) -(defun mastodon-serach--query-accounts-followed (query) +(defun mastodon-search--query-accounts-followed (query) "Run an accounts search QUERY, limited to your followers." (interactive "sSearch mastodon for: ") (mastodon-search--query query "accounts" :following)) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index d4f3d04..d21edaf 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -190,6 +190,11 @@ re-load mastodon.el, or restart Emacs." :type '(choice (const :tag "true" t) (const :tag "false" nil) (const :tag "follow server setting" server))) + +(defcustom mastodon-tl--tag-timeline-tags nil + "A list of up to four tags for use with `mastodon-tl--followed-tags-timeline'." + :type '(repeat string)) + ;;; VARIABLES @@ -2144,7 +2149,10 @@ ARGS is an alist of any parameters to send with the request." (mapconcat #'cdr args " "))) ((and (eq notify nil) (eq reblogs nil)) - (message "User %s (@%s) %sed!" name user-handle action)))))))) + (if (and (equal action "follow") + (eq t (alist-get 'requested json))) + (message "Follow requested for user %s (@%s)!" name user-handle) + (message "User %s (@%s) %sed!" name user-handle action))))))))) ;; FOLLOW TAGS @@ -2206,13 +2214,14 @@ PREFIX is sent to `mastodon-tl--get-tag-timeline', which see." (mastodon-tl--get-tag-timeline prefix tag)))) (defun mastodon-tl--followed-tags-timeline (&optional prefix) - "Open a timeline of all your followed tags. + "Open a timeline of multiple tags. PREFIX is sent to `mastodon-tl--show-tag-timeline', which see. -Note that the number of tags supported is undocumented, and from -manual testing appears to be limited to a total of four tags." +If `mastodon-tl--tag-timeline-tags' is set, use its tags, else +fetch followed tags and load the first four of them." (interactive "p") (let* ((followed-tags-json (mastodon-tl--followed-tags)) - (tags (mastodon-tl--map-alist 'name followed-tags-json))) + (tags (or mastodon-tl--tag-timeline-tags + (mastodon-tl--map-alist 'name followed-tags-json)))) (mastodon-tl--show-tag-timeline prefix tags))) (defun mastodon-tl--some-followed-tags-timeline (&optional prefix) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 51990fd..462f925 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -517,6 +517,11 @@ base toot." (kill-new url) (message "Toot URL copied to the clipboard."))) +(defun mastodon-toot--open-toot-url () + "Open URL of toot at point." + (interactive) + (browse-url (mastodon-toot--toot-url))) + (defun mastodon-toot--toot-url () "Return the URL of the base toot at point." (let* ((toot (or (mastodon-tl--property 'base-toot) @@ -1225,6 +1230,30 @@ File is actually attached to the toot upon posting." (mastodon-toot--upload-attached-media (car (last mastodon-toot--media-attachments))))) +(defun mastodon-toot--attachment-descriptions () + "Return a list of image descriptions for current attachments." + (mapcar (lambda (a) + (alist-get :description a)) + mastodon-toot--media-attachments)) + +(defun mastodon-toot--attachment-from-desc (desc) + "Return an attachment based on its description DESC." + (car + (cl-member-if (lambda (x) + (rassoc desc x)) + mastodon-toot--media-attachments))) + +(defun mastodon-toot--edit-media-description () + "Prompt for an attachment, and update its description." + (interactive) + (let* ((descs (mastodon-toot--attachment-descriptions)) + (choice (completing-read "Attachment: " descs nil :match)) + (attachment (mastodon-toot--attachment-from-desc choice)) + (desc-new (read-string "Description: " choice))) + (setf (alist-get :description attachment) + desc-new) + (mastodon-toot--refresh-attachments-display))) + (defun mastodon-toot--upload-attached-media (attachment) "Upload a single ATTACHMENT using `mastodon-http--post-media-attachment'. The item's id is added to `mastodon-toot--media-attachment-ids', diff --git a/lisp/mastodon-views.el b/lisp/mastodon-views.el index 28f7c7c..8e04434 100644 --- a/lisp/mastodon-views.el +++ b/lisp/mastodon-views.el @@ -572,14 +572,14 @@ NO-CONFIRM means there is no ask or message, there is only do." (let* ((toot (mastodon-tl--property 'scheduled-json :no-move)) (scheduled (alist-get 'scheduled_at toot))) (let-alist (alist-get 'params toot) + ;; TODO: preserve polls ;; (poll (alist-get 'poll params)) - ;; (media (alist-get 'media_attachments toot))) - (mastodon-toot--compose-buffer) + (mastodon-toot--compose-buffer nil .in_reply_to_id nil .text :edit) (goto-char (point-max)) - (insert .text) ;; adopt properties from scheduled toot: (mastodon-toot--set-toot-properties - .in_reply_to_id .visibility .spoiler_text .language scheduled id)))))) + .in_reply_to_id .visibility .spoiler_text .language + scheduled id (alist-get 'media_attachments toot))))))) ;;; FILTERS diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 93e802e..142eced 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -184,6 +184,7 @@ Use. e.g. \"%c\" for your locale's date and time format." (define-key map (kbd "k") #'mastodon-toot--toggle-bookmark) (define-key map (kbd "r") #'mastodon-toot--reply) (define-key map (kbd "C") #'mastodon-toot--copy-toot-url) + (define-key map (kbd "o") #'mastodon-toot--open-toot-url) (define-key map (kbd "v") #'mastodon-tl--poll-vote) (define-key map (kbd "E") #'mastodon-toot--view-toot-edits) (define-key map (kbd "T") #'mastodon-tl--thread) @@ -225,6 +226,7 @@ Use. e.g. \"%c\" for your locale's date and time format." (define-key map (kbd "G") #'mastodon-views--view-follow-suggestions) (define-key map (kbd "X") #'mastodon-views--view-lists) (define-key map (kbd "SPC") #'mastodon-tl--scroll-up-command) + (define-key map (kbd "z") #'bury-buffer) map) "Keymap for `mastodon-mode'.") diff --git a/mastodon-index.org b/mastodon-index.org index d0918e3..90e7bf7 100644 --- a/mastodon-index.org +++ b/mastodon-index.org @@ -52,6 +52,7 @@ | | mastodon-async-mode | Async Mastodon. | | | mastodon-discover | Plug Mastodon functionality into `discover'. | | C-M-q | mastodon-kill-all-buffers | Kill any and all open mastodon buffers, hopefully. | +| Q | mastodon-kill-window | Quit window and delete helper. | | | mastodon-mode | Major mode for Mastodon, the federated microblogging network. | | | mastodon-notifications--clear-all | Clear all notifications. | | C-k | mastodon-notifications--clear-current | Dismiss the notification at point. | @@ -76,6 +77,7 @@ | | mastodon-profile--open-followers | Open a profile buffer showing the accounts following the current profile. | | | mastodon-profile--open-following | Open a profile buffer showing the accounts that current profile follows. | | | mastodon-profile--open-statuses-no-reblogs | Open a profile buffer showing statuses without reblogs. | +| | mastodon-profile--open-statuses-no-replies | Open a profile buffer showing statuses including replies. | | | mastodon-profile--remove-from-followers-at-point | Prompt for a user in the item at point and remove from followers. | | | mastodon-profile--remove-from-followers-list | Select a user from your followers and remove from followers. | | | mastodon-profile--remove-user-from-followers | Remove a user from your followers. | @@ -93,13 +95,14 @@ | | mastodon-profile-mode | Toggle mastodon profile minor mode. | | | mastodon-profile-update-mode | Minor mode to update Mastodon user profile. | | s | mastodon-search--query | Prompt for a search QUERY and return accounts, statuses, and hashtags. | +| | mastodon-search--query-accounts-followed | Run an accounts search QUERY, limited to your followers. | | | mastodon-search--query-cycle | Cycle through search types: accounts, hashtags, and statuses. | | | mastodon-search--trending-statuses | Display a list of statuses trending on your instance. | | | mastodon-search--trending-tags | Display a list of tags trending on your instance. | | | mastodon-search-mode | Toggle mastodon search minor mode. | -| | mastodon-serach--query-accounts-followed | Run an accounts search QUERY, limited to your followers. | | B | mastodon-tl--block-user | Query for USER-HANDLE from current status and block that user. | | <mouse-2> | mastodon-tl--click-image-or-video | Click to play video with `mpv.el'. | +| | mastodon-tl--copy-image-caption | Copy the caption of the image at point. | | | mastodon-tl--disable-notify-user-posts | Query for USER-HANDLE and disable notifications when they post. | | m | mastodon-tl--dm-user | Query for USER-HANDLE from current status and compose a message to that user. | | | mastodon-tl--do-link-action | Do the action of the link at point. | @@ -110,7 +113,7 @@ | W | mastodon-tl--follow-user | Query for USER-HANDLE from current status and follow that user. | | | mastodon-tl--follow-user-disable-boosts | Prompt for a USER-HANDLE, and disable display of boosts in home timeline. | | | mastodon-tl--follow-user-enable-boosts | Prompt for a USER-HANDLE, and enable display of boosts in home timeline. | -| ' | mastodon-tl--followed-tags-timeline | Open a timeline of all your followed tags. | +| ' | mastodon-tl--followed-tags-timeline | Open a timeline of multiple tags. | | F | mastodon-tl--get-federated-timeline | Open federated timeline. | | H | mastodon-tl--get-home-timeline | Open home timeline. | | L | mastodon-tl--get-local-timeline | Open local timeline. | @@ -131,7 +134,7 @@ | SPC | mastodon-tl--scroll-up-command | Call `scroll-up-command', loading more toots if necessary. | | | mastodon-tl--single-toot | View toot at point in separate buffer. | | | mastodon-tl--some-followed-tags-timeline | Prompt for some tags, and open a timeline for them. | -| T | mastodon-tl--thread | Open thread buffer for toot at point or with ID. | +| RET, T | mastodon-tl--thread | Open thread buffer for toot at point or with ID. | | c | mastodon-tl--toggle-spoiler-text-in-toot | Toggle the visibility of the spoiler text in the current toot. | | C-S-b | mastodon-tl--unblock-user | Query for USER-HANDLE from list of blocked users and unblock that user. | | | mastodon-tl--unfollow-tag | Prompt for a followed tag, and unfollow it. | @@ -153,12 +156,14 @@ | | mastodon-toot--delete-draft-toot | Prompt for a draft toot and delete it. | | d | mastodon-toot--delete-toot | Delete user's toot at point synchronously. | | | mastodon-toot--download-custom-emoji | Download `mastodon-instance-url's custom emoji. | +| | mastodon-toot--edit-media-description | Prompt for an attachment, and update its description. | | e | mastodon-toot--edit-toot-at-point | Edit the user's toot at point. | | | mastodon-toot--enable-custom-emoji | Add `mastodon-instance-url's custom emoji to `emojify'. | | C-c C-e | mastodon-toot--insert-emoji | Prompt to insert an emoji. | | . | mastodon-toot--list-toot-boosters | List the boosters of toot at point. | | , | mastodon-toot--list-toot-favouriters | List the favouriters of toot at point. | | | mastodon-toot--open-draft-toot | Prompt for a draft and compose a toot with it. | +| o | mastodon-toot--open-toot-url | Open URL of toot at point. | | i | mastodon-toot--pin-toot-toggle | Pin or unpin user's toot at point. | | r | mastodon-toot--reply | Reply to toot at `point'. | | | mastodon-toot--save-draft | Save the current compose toot text as a draft. | @@ -176,6 +181,7 @@ | | mastodon-toot-mode | Minor mode to capture Mastodon toots. | | | mastodon-turn-on-discover | Turns on discover support | | | mastodon-url-lookup | If a URL resembles a mastodon link, try to load in `mastodon.el'. | +| | mastodon-url-lookup-force | Call `mastodon-url-lookup' without checking if URL is fedi-like. | | | mastodon-views--add-account-to-list | Prompt for a list and for an account, add account to list. | | | mastodon-views--add-account-to-list-at-point | Prompt for account and add to list at point. | | | mastodon-views--add-toot-account-at-point-to-list | Prompt for a list, and add the account of the toot at point to it. | |