branch: elpa/mastodon commit 2959ec90ed5813be3efd3b1942815d911c41a416 Merge: f6247f0c9b cc15095240 Author: marty hiatt <martianhia...@disroot.org> Commit: marty hiatt <martianhia...@disroot.org>
Merge branch 'develop' --- Makefile | 2 +- lisp/mastodon-http.el | 14 +- lisp/mastodon-profile.el | 26 ++- lisp/mastodon-tl.el | 146 ++++++++---- lisp/mastodon-toot.el | 18 +- lisp/mastodon.el | 3 +- mastodon-index.org | 518 +++++++++++++++++++++-------------------- test/mastodon-http-tests.el | 4 +- test/mastodon-media-tests.el | 43 +++- test/mastodon-profile-tests.el | 79 ++++--- test/mastodon-tl-tests.el | 94 ++++---- test/mastodon-toot-tests.el | 2 +- 12 files changed, 543 insertions(+), 406 deletions(-) diff --git a/Makefile b/Makefile index 19ed6811e4..b853b39e53 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ tests: cask emacs -batch -load test/ert-helper.el -f ert-run-tests-batch-and-exit testsclean: - rm -f stubfile.plstore~ + cask clean-elc && rm -f stubfile.plstore~ ## ################################################################ diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el index a91f272dd4..fc456925e5 100644 --- a/lisp/mastodon-http.el +++ b/lisp/mastodon-http.el @@ -68,13 +68,21 @@ SILENT means don't message." (url-retrieve-synchronously url) (url-retrieve-synchronously url (or silent nil) nil mastodon-http--timeout))) +(defun mastodon-http--response-status (resp) + "Return the status code from RESP, a response buffer." + ;; `url-http-parse-response' breaks tests, as + ;; `url-http-end-of-headers' not set, so we roll our own: + (with-current-buffer resp + (goto-char (point-min)) + (skip-chars-forward " \t\n") ; Skip any blank crap + (skip-chars-forward "/HPT0-9.") ; Skip HTTP Version "HTTP/X.Y" + (read (current-buffer)))) + (defun mastodon-http--triage (response success) "Determine if RESPONSE was successful. Call SUCCESS on RESPONSE if successful. Message status and JSON error from RESPONSE if unsuccessful." - (let ((status (with-current-buffer response - ;; FIXME: breaks tests, as url-http-end-of-headers not set - (url-http-parse-response)))) + (let ((status (mastodon-http--response-status response))) (if (and (>= 200 status) (<= status 299)) ;; (string-prefix-p "2" (number-to-string status)) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 177179fdf1..8c947334cd 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -636,6 +636,22 @@ FIELDS means provide a fields vector fetched by other means." 'face `(:box t :foreground ,(alist-get 'color role)))) roles)) +(defun mastodon-profile--render-moved (data) + "Return a propertized string of a migrated account link. +DATA is an account data from a moved field in profile data." + (let-alist data + (let ((handle (concat "@" .acct))) + (concat + "this account has migrated to: " + (mastodon-tl--buttonify-link + handle + 'face 'shr-link ;'mastodon-handle-face + 'mastodon-tab-stop 'user-handle + 'shr-url .url + 'mastodon-handle handle + 'help-echo (concat "Browse user profile of " handle)) + "\n\n")))) + (defun mastodon-profile--make-profile-buffer-for (account endpoint-type update-function &optional no-reblogs headers no-replies only-media tag max-id) @@ -694,7 +710,10 @@ MAX-ID is a flag to include the max_id pagination parameter." (mastodon-profile--image-from-account account 'header_static) "\n" (when .display_name - (propertize .display_name 'face 'mastodon-display-name-face)) + (propertize (if (string-empty-p .display_name) + .username + .display_name) + 'face 'mastodon-display-name-face)) ;; roles (when .roles (concat " " (mastodon-profile--render-roles .roles))) @@ -703,6 +722,9 @@ MAX-ID is a flag to include the max_id pagination parameter." (when (eq .locked t) (concat " " (mastodon-tl--symbol 'locked))) "\n " mastodon-tl--horiz-bar "\n" + ;; migration: + (when .moved + (mastodon-profile--render-moved .moved)) ;; profile note: (mastodon-tl--render-text .note account) ; account = tab-stops in profile ;; meta fields: @@ -868,7 +890,7 @@ Used to view a user's followers and those they're following." (insert "\n" (propertize - (mastodon-tl--byline-author `((account . ,toot)) :avatar) + (mastodon-tl--byline-author `((account . ,toot)) :avatar nil :base) 'byline 't 'item-id (alist-get 'id toot) 'base-item-id (mastodon-tl--item-id toot) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index b1a5b90cdd..da2a9122d3 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -633,6 +633,13 @@ Do so if type of status at poins is not follow_request/follow." (string= type "follow")) ; no counts for these (message "%s" echo))))) +(defun mastodon-tl--unicode-wrap (str) + "Wrap STR in unicode directional isolates." + ;; see https://unicode.org/reports/tr9/#Explicit_Directional_Isolates + ;; via Tusky (again! thanks) + ;; https://codeberg.org/tusky/Tusky/src/commit/16cef3d6202648e4fd67f06ef0fb1d0a2d04b68f/app/src/main/java/com/keylesspalace/tusky/util/StringUtils.kt#L65 + (concat "\u2068" str "\u2069")) + (defun mastodon-tl--byline-username (toot) "Format a byline username from account in TOOT. TOOT may be account data, or toot data, in which case acount data @@ -640,23 +647,24 @@ is extracted from it." (let ((data (or (alist-get 'account toot) toot))) ;; grouped nofifs use account data directly (let-alist data - (propertize (if (and .display_name + (let ((disp (if (and .display_name (not (string-empty-p .display_name))) - .display_name - .username) - 'face 'mastodon-display-name-face - ;; enable playing of videos when point is on byline: - ;; 'attachments (mastodon-tl--get-attachments-for-byline toot) - 'keymap mastodon-tl--byline-link-keymap - ;; echo faves count when point on post author name: - ;; which is where --goto-next-toot puts point. - 'help-echo - ;; but don't add it to "following"/"follows" on - ;; profile views: we don't have a tl--buffer-spec - ;; yet: - (unless (or (string-suffix-p "-followers*" (buffer-name)) - (string-suffix-p "-following*" (buffer-name))) - (mastodon-tl--format-byline-help-echo data)))))) + (mastodon-tl--unicode-wrap .display_name) + .username))) + (propertize disp + 'face 'mastodon-display-name-face + ;; enable playing of videos when point is on byline: + ;; 'attachments (mastodon-tl--get-attachments-for-byline toot) + 'keymap mastodon-tl--byline-link-keymap + ;; echo faves count when point on post author name: + ;; which is where --goto-next-toot puts point. + 'help-echo + ;; but don't add it to "following"/"follows" on + ;; profile views: we don't have a tl--buffer-spec + ;; yet: + (unless (or (string-suffix-p "-followers*" (buffer-name)) + (string-suffix-p "-following*" (buffer-name))) + (mastodon-tl--format-byline-help-echo data))))))) (defun mastodon-tl--byline-handle (toot &optional domain string face) "Format a byline handle from account in TOOT. @@ -669,18 +677,19 @@ The last two args allow for display a username as a clickable handle." (let-alist (or (alist-get 'account toot) toot) ;; grouped notifs - (mastodon-tl--buttonify-link - (or string - (concat "@" .acct - (when domain - (concat "@" - (url-host - (url-generic-parse-url .url)))))) - 'face (or face 'mastodon-handle-face) - 'mastodon-tab-stop 'user-handle - 'shr-url .url - 'mastodon-handle (concat "@" .acct) - 'help-echo (concat "Browse user profile of @" .acct)))) + (let ((str (or string + (concat "@" .acct + (when domain + (concat "@" + (url-host + (url-generic-parse-url .url)))))))) + (mastodon-tl--buttonify-link + (mastodon-tl--unicode-wrap str) + 'face (or face 'mastodon-handle-face) + 'mastodon-tab-stop 'user-handle + 'shr-url .url + 'mastodon-handle (concat "@" .acct) + 'help-echo (concat "Browse user profile of @" .acct))))) (defun mastodon-tl--byline-uname-+-handle (data &optional domain) "Concatenate a byline username and handle. @@ -916,10 +925,10 @@ TS is a timestamp from the server, if any." 'face 'mastodon-display-name-face 'follow-link t 'mouse-face 'highlight - 'mastodon-tab-stop 'shr-url - 'shr-url app-url + 'mastodon-tab-stop 'shr-url + 'shr-url app-url 'help-echo app-url - 'keymap mastodon-tl--shr-map-replacement))))) + 'keymap mastodon-tl--shr-map-replacement))))) ;; edited: (when edited-time (concat @@ -1038,7 +1047,7 @@ links in the text. If TOOT is nil no parsing occurs." ;; FIXME: replace with refactored handle render fun ;; in byline refactor branch: (concat - (propertize (or .display_name .username) + (propertize (mastodon-tl--unicode-wrap (or .display_name .username)) 'face 'mastodon-display-name-face 'item-type 'user 'item-id .id) @@ -1046,10 +1055,10 @@ links in the text. If TOOT is nil no parsing occurs." (propertize (concat "@" .acct) 'face 'mastodon-handle-face 'mouse-face 'highlight - 'mastodon-tab-stop 'user-handle - 'keymap mastodon-tl--link-keymap + 'mastodon-tab-stop 'user-handle + 'keymap mastodon-tl--link-keymap 'mastodon-handle (concat "@" .acct) - 'help-echo (concat "Browse user profile of @" .acct)))))) + 'help-echo (concat "Browse user profile of @" .acct)))))) (defun mastodon-tl--process-link (toot start end url) "Process link URL in TOOT as hashtag, userhandle, or normal link. @@ -1162,11 +1171,14 @@ the toot)." (let* ((instance-host (url-host (url-generic-parse-url instance-url))) (parsed (url-generic-parse-url url)) - (path (url-filename parsed)) - (split (split-string path "/"))) - (when (and (string= instance-host (url-host parsed)) - (string-prefix-p "/tag" path)) ;; "/tag/" or "/tags/" - (nth 2 split)))) + (path (url-filename parsed))) + (when (string= instance-host (url-host parsed)) + (cond ((string-prefix-p "/tag" path) ;; "/tag/" or "/tags/" + (let ((split (split-string path "/"))) + (nth 2 split))) + ((string-prefix-p "?t=" path) ;; snac tag + (let ((split (split-string path "="))) + (nth 1 split))))))) (defun mastodon-tl--base-tags (tags body-tags) "Return a string of all tags not in BODY-TAGS, linkified. @@ -1181,9 +1193,11 @@ TAGS is a list of tag alists, from a post's JSON." (defun mastodon-tl--base-tags-print-p (tags body-tags) "Non-nil if we need to print base tags. We need to do so if TAGS contains any elements not in BODY-TAGS." - (cl-remove-if (lambda (tag) - (member (alist-get 'name tag) body-tags)) - tags)) + (cl-remove-if + (lambda (tag) + ;; downcase name string (body strings are downcased): + (member (downcase (alist-get 'name tag)) body-tags)) + tags)) (defun mastodon-tl--render-base-tag (tag body-tags) "Return TAG as a linkified string, provided it is not in BODY-TAGS." @@ -2657,7 +2671,7 @@ Note that you can only (un)mute threads you have posted in." (mastodon-tl--goto-first-item) (mastodon-tl--property 'base-item-id :no-move))) -(defun mastodon-tl--mute-or-unmute-thread (&optional unmute) +(defun mastodon-tl--mute-or-unmute-thread (&optional unmute) "Mute a thread. If UNMUTE, unmute it." (let ((mute-str (if unmute "unmute" "mute"))) @@ -2673,7 +2687,7 @@ If UNMUTE, unmute it." (url (mastodon-http--api (format "statuses/%s/%s" id mute-str)))) (if (not we-posted-p) (user-error "You can only (un)mute a thread you have posted in") - (when (y-or-n-p (format "%s this thread? " (capitalize mute-str))) + (when (y-or-n-p (format "%s this thread? " mute-str)) (let ((response (mastodon-http--post url))) (mastodon-http--triage response @@ -3092,8 +3106,9 @@ PREFIX is sent to `mastodon-tl-get-tag-timeline', which see." PREFIX is sent to `mastodon-tl-get-tag-timeline', which see." (interactive) (let* ((json (mastodon-tl--followed-tags)) - (sorted (sort json :key (lambda (x) - (downcase (alist-get 'name x))))) + (sorted (cl-sort json #'string-lessp + :key (lambda (x) + (downcase (alist-get 'name x))))) (buf "*mastodon-followed-tags*")) (if (null sorted) (user-error "You have to follow some tags first") @@ -3794,6 +3809,43 @@ TYPE is a notification type." (unless (mastodon-tl--profile-buffer-p) (mastodon-tl--goto-first-item))) +;;; NODEINFO + +(defun mastodon-tl--get-nodeinfo (instance &optional version) + "Return Nodeinfo data for INSTANCE, optionally for version." + ;; NB: not in the API: + (let ((url (format "https://%s/nodeinfo/%s" instance (or version "2.0")))) + (mastodon-http--get-json url))) + +(defun mastodon-tl-nodeinfo-for-toot () + "Return Nodeinfo for toot at point. +Displays what software and version an instance is running. +Also the instances description and usage stats, etc. +Nodeinfo is a data standard for distributed social networks, see +https://nodeinfo.diaspora.software." + (interactive) + (let* ((item (mastodon-tl--property 'item-json)) + (url (mastodon-tl--field 'url item)) + (instance (url-host (url-generic-parse-url url))) + (data (mastodon-tl--get-nodeinfo instance))) + (when data ;; don't display empty message when fetching failed + (if (eq 'error (caar data)) + (user-error "Error: %s" (alist-get 'error data)) + (mastodon-tl--render-nodeinfo data))))) + +(defun mastodon-tl--render-nodeinfo (data) + "Render Nodeinfo DADA as message." + (let-alist data + (message + "%s" + (concat "Software: " + .software.name " " .software.version + (if (not .metadata) + "" + (concat + "\nInstance: " + .metadata.nodeName " " .metadata.nodeDescription)))))) + ;;; BOOKMARKS (require 'bookmark) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 697e582049..02b4d1f0b0 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -251,9 +251,12 @@ send.") ;;; REGEXES (defvar mastodon-toot-handle-regex - (rx (| (any ?\( "\n" "\t "" ") bol) ; preceding things - (group-n 2 (+ ?@ (* (any ?- ?_ ?. "A-Z" "a-z" "0-9" ))) ; handle - (? ?@ (* (not (any "\n" "\t" " "))))) ; optional domain + (rx (group-n 2 ; include domain + (group-n 4 ; exclude domain + (| (any ?\( "\n" "\t" " ") bol) ; preceding things + ?@ ; first @ + (* (any ?- ?_ ?. "A-Z" "a-z" "0-9" ))) ; username + (? ?@ (* (not (any "\n" "\t" " "))))) ; optional domain (| "'" word-boundary))) ; boundary or possessive (defvar mastodon-toot-tag-regex @@ -1884,10 +1887,11 @@ CW is the content warning, which contributes to the character count." ;; FIXME: URL chars is avail at /api/v1/instance ;; for masto, it's .statuses.characters_reserved_per_url (let* ((url-replacement (make-string 23 ?x)) - (count-str (replace-regexp-in-string ; handle @handles - mastodon-toot-handle-regex "\2" - (replace-regexp-in-string ; handle URLs - mastodon-toot-url-regex url-replacement toot-string)))) + (count-str + (replace-regexp-in-string ; handle @handles + mastodon-toot-handle-regex "\\4" + (replace-regexp-in-string ; handle URLs + mastodon-toot-url-regex url-replacement toot-string)))) (+ (length cw) (length count-str)))) diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 185a85edd9..9b4f570dad 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -6,7 +6,7 @@ ;; Author: Johnson Denen <johnson.de...@gmail.com> ;; Marty Hiatt <mouse...@disroot.org> ;; Maintainer: Marty Hiatt <mouse...@disroot.org> -;; Version: 2.0.1 +;; Version: 2.0.2 ;; Package-Requires: ((emacs "28.1") (persist "0.4") (tp "0.7")) ;; Homepage: https://codeberg.org/martianh/mastodon.el @@ -267,6 +267,7 @@ Also nil `mastodon-auth--token-alist'." (define-key map (kbd ",") #'mastodon-toot-list-favouriters) (define-key map (kbd ".") #'mastodon-toot-list-boosters) (define-key map (kbd ";") #'mastodon-views-view-instance-description) + (define-key map (kbd "M-;") #'mastodon-tl-nodeinfo-for-toot) ;; override special mode binding (define-key map (kbd "g") #'undefined) (define-key map (kbd "g") #'mastodon-tl-update) diff --git a/mastodon-index.org b/mastodon-index.org index b10b4a45e1..8d41afdcde 100644 --- a/mastodon-index.org +++ b/mastodon-index.org @@ -2,262 +2,286 @@ * mastodon commands index #+BEGIN_SRC emacs-lisp :results table :colnames '("Binding" "Command" "Description") :exports results + (defvar readme-maps + (mapcar (lambda (x) + x) + (list mastodon-mode-map + mastodon-toot-mode-map + mastodon-profile-mode-map + mastodon-notifications--map + mastodon-tl--shr-image-map-replacement + mastodon-profile-update-mode-map + mastodon-views-map + mastodon-views--follow-suggestions-map + mastodon-views--scheduled-map + mastodon-views--view-lists-keymap + mastodon-views--view-follow-requests-keymap + mastodon-views--view-filters-keymap))) + + (defun readme-where-is-map (symbol maps) + "" + (cl-remove-duplicates + (flatten-tree + (mapcar (lambda (x) + (where-is-internal symbol x t nil (command-remapping symbol))) + maps)) + :test #'equal)) + + (defun readme-push-rows (symbol) + (let* ((doc (car + (split-string + (or (documentation symbol t) "") + "\n"))) + (maps readme-maps) + (binding-codes + (let ((keys (readme-where-is-map symbol maps))) + ;; just take first 2 bindings: + (if (> (length keys) 2) + (list (car keys) (cadr keys)) + keys))) + (binding-str (if binding-codes + (mapconcat + (lambda (x) + (key-description x)) + binding-codes ", ") + ""))) + (push `(,binding-str ,symbol ,doc) rows) + rows)) + (let (rows) (mapatoms (lambda (symbol) (when (and (string-match "^mastodon" (symbol-name symbol)) (commandp symbol)) - (let* ((doc (car - (split-string - (or (documentation symbol t) "") - "\n"))) - ;; add more keymaps here - ;; some keys are in sub 'keymap keys inside a map - (maps (list mastodon-mode-map - mastodon-toot-mode-map - mastodon-profile-mode-map - mastodon-notifications--map - mastodon-tl--shr-image-map-replacement - mastodon-profile-update-mode-map - mastodon-views-map - mastodon-views--follow-suggestions-map - mastodon-views--scheduled-map - mastodon-views--view-lists-keymap - mastodon-views--view-follow-requests-keymap - mastodon-views--view-filters-keymap)) - (binding-code - (let ((keys (where-is-internal symbol maps nil nil (command-remapping symbol)))) - ;; just take first 2 bindings: - (if (> (length keys) 2) - (list (car keys) (cadr keys)) - keys))) - ;; (or (car (rassoc symbol mastodon-mode-map)) - ;; (car (rassoc symbol (cadr mastodon-toot-mode-map))) - ;; (car (rassoc symbol (cadr mastodon-profile-mode-map))) - ;; (car (rassoc symbol mastodon-notifications--map)))) - (binding-str (if binding-code - (mapconcat #'help--key-description-fontified - binding-code ", ") - ""))) - (push `(,binding-str ,symbol ,doc) rows) - rows)))) - (sort rows (lambda (x y) (string-lessp (cadr x) (cadr y))))) + (readme-push-rows symbol)))) + (sort rows + (lambda (x y) + (string-lessp (cadr x) (cadr y))))) #+END_SRC #+RESULTS: -| Binding | Command | Description | -|------------------+---------------------------------------------------+--------------------------------------------------------------------------------| -| | mastodon | Connect client to `mastodon-instance-url' instance. | -| | mastodon-async-mode | Async Mastodon. | -| C-c C-p | mastodon-create-poll | A transient for creating a poll. | -| | mastodon-create-poll-done | Update current user profile fields. | -| 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 fediverse services using the Mastodon API. | -| | mastodon-forget-all-logins | Delete `mastodon-client--token-file'. | -| | mastodon-notifications-clear-all | Clear all notifications. | -| C-k | mastodon-notifications-clear-current | Dismiss the notification at point. | -| | mastodon-notifications-cycle-type | Cycle the current notifications view. | -| | mastodon-notifications-follow-request-accept | Accept a follow request. | -| j | mastodon-notifications-follow-request-reject | Reject a follow request. | -| N | mastodon-notifications-get | Display NOTIFICATIONS in buffer. | -| | mastodon-notifications-get-boosts | Display boost notifications in buffer. | -| | mastodon-notifications-get-edits | Display edited post notifications in buffer. | -| | mastodon-notifications-get-favourites | Display favourite notifications in buffer. | -| | mastodon-notifications-get-follow-requests | Display follow request notifications in buffer. | -| | mastodon-notifications-get-follows | Display follow notifications in buffer. | -| @ | mastodon-notifications-get-mentions | Display mention notifications in buffer. | -| | mastodon-notifications-get-polls | Display poll notifications in buffer. | -| | mastodon-notifications-get-single-notif | Return a single notification JSON for v2 notifs. | -| | mastodon-notifications-get-statuses | Display status notifications in buffer. | -| | mastodon-notifications-get-type | Read a notification type and load its timeline. | -| C-: | mastodon-notifications-policy | A transient to set notifications policy options. | -| | mastodon-notifications-policy-update | Send updated notification policy settings. | -| | mastodon-notifications-request-accept | Accept a notification request for a user. | -| | mastodon-notifications-request-reject | Reject a notification request for a user. | -| C-S-n | mastodon-notifications-requests | Open a new buffer displaying the user's notification requests. | -| | mastodon-profile-account-bot-toggle | Toggle the bot status of your account. | -| | mastodon-profile-account-discoverable-toggle | Toggle the discoverable status of your account. | -| | mastodon-profile-account-locked-toggle | Toggle the locked status of your account. | -| | mastodon-profile-account-search | Run a statuses search QUERY for the currently viewed account. | -| | mastodon-profile-account-sensitive-toggle | Toggle the sensitive status of your account. | -| | mastodon-profile-account-view-cycle | Cycle through profile view: toots, toot sans boosts, followers, and following. | -| | mastodon-profile-add-account-to-list | Add account of current profile buffer to a list. | -| | mastodon-profile-add-private-note-to-account | Add a private note to an account. | -| | mastodon-profile-fields | A transient for setting profile fields. | -| | mastodon-profile-fields-update | Update current user profile fields. | -| A | mastodon-profile-get-toot-author | Open profile of author of toot under point. | -| | mastodon-profile-mode | Toggle mastodon profile minor mode. | -| O | mastodon-profile-my-profile | Show the profile of the currently signed in user. | -| | 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 | Open a profile showing statuses. | -| | 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 without replies. | -| | mastodon-profile-open-statuses-only-media | Open a profile buffer showing only statuses with media. | -| C-c # | mastodon-profile-open-statuses-tagged | Prompt for a hashtag and display a profile with only statuses containing it. | -| | 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. | -| | mastodon-profile-show-familiar-followers | Show a list of familiar followers. | -| P | mastodon-profile-show-user | Query for USER-HANDLE from current status and show that user's profile. | -| | mastodon-profile-update-display-name | Update display name for your account. | -| | mastodon-profile-update-meta-fields | Prompt for new metadata fields information and PATCH the server. | -| | mastodon-profile-update-mode | Minor mode to update user profile. | -| | mastodon-profile-update-profile-note-cancel | Cancel updating user profile and kill buffer and window. | -| U | mastodon-profile-update-user-profile-note | Fetch user's profile note and display for editing. | -| | mastodon-profile-user-profile-send-updated | Send PATCH request with the updated profile note. | -| | mastodon-profile-view-account-private-note | Display the private note about a user. | -| K | mastodon-profile-view-bookmarks | Open a new buffer displaying the user's bookmarks. | -| V | mastodon-profile-view-favourites | Open a new buffer displaying the user's favourites. | -| | mastodon-profile-view-preferences | View user preferences in another window. | -| | mastodon-search-load-link-posts | Load timeline of posts containing link at point. | -| | mastodon-search-mode | Toggle mastodon search minor mode. | -| 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-links | Display a list of links trending on your instance. | -| | 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-switch-to-buffer | Switch to a live mastodon buffer. | -| | mastodon-tl-announcements | Display announcements from your instance. | -| | mastodon-tl-block-domain | Read a domain and block it. | -| 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. | -| | mastodon-tl-do-link-action-at-point | Do the action of the link at POS. | -| | mastodon-tl-enable-notify-user-posts | Query for USER-HANDLE and enable notifications when they post. | -| | mastodon-tl-filter-user-user-posts-by-language | Query for USER-HANDLE and filter display of their posts by language. | -| | mastodon-tl-fold-post | Fold post at point, if it is too long. | -| ! | mastodon-tl-fold-post-toggle | Toggle the folding status of the toot at point. | -| | mastodon-tl-follow-tag | Prompt for a tag (from post at point) and follow it. | -| W | mastodon-tl-follow-user | Query for USER-HANDLE from current status and follow that user. | -| | mastodon-tl-follow-user-by-handle | Prompt for a USER-HANDLE 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 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. | -| \ | mastodon-tl-get-remote-local-timeline | Prompt for an instance domain and try to display its local timeline. | -| # | mastodon-tl-get-tag-timeline | Prompt for tag and opens its timeline. | -| n | mastodon-tl-goto-next-item | Jump to next item. | -| p | mastodon-tl-goto-prev-item | Jump to previous item. | -| " | mastodon-tl-list-followed-tags | List followed tags. View timeline of tag user choses. | -| C-<return> | mastodon-tl-mpv-play-video-at-point | Play the video or gif at point with an mpv process. | -| | mastodon-tl-mpv-play-video-from-byline | Run `mastodon-tl-mpv-play-video-at-point' on first moving image in post. | -| | mastodon-tl-mute-thread | Mute the thread displayed in the current buffer. | -| M | mastodon-tl-mute-user | Query for USER-HANDLE from current status and mute that user. | -| | mastodon-tl-next-full-image | From full image view buffer, load the toot's next image. | -| TAB, M-n | mastodon-tl-next-tab-item | Move to the next interesting item. | -| v | mastodon-tl-poll-vote | If there is a poll at point, prompt user for OPTION to vote on it. | -| | mastodon-tl-prev-full-image | From full image view buffer, load the toot's prev image. | -| S-TAB, <backtab> | mastodon-tl-previous-tab-item | Move to the previous interesting item. | -| | mastodon-tl-remote-tag-timeline | Call `mastodon-tl-get-remote-local-timeline' but for a TAG timeline. | -| Z | mastodon-tl-report-to-mods | Report the author of the toot at point to your instance moderators. | -| SPC | mastodon-tl-scroll-up-command | Call `scroll-up-command', loading more toots if necessary. | -| | mastodon-tl-shr-browse-image | Browse the image under point. | -| | 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. | -| C-' | mastodon-tl-tag-group-timeline | Load a timeline of a tag group from `mastodon-tl--tags-groups'. | -| RET, T | mastodon-tl-thread | Open thread buffer for toot at point. | -| | mastodon-tl-toggle-sensitive-image | Toggle dislay of sensitive image at point. | -| | mastodon-tl-toggle-spoiler-in-thread | Toggler content warning for all posts in current thread. | -| c | mastodon-tl-toggle-spoiler-text-in-toot | Toggle the visibility of the spoiler text in the current toot. | -| | mastodon-tl-unblock-domain | Read a blocked domain and unblock it. | -| C-S-b | mastodon-tl-unblock-user | Query for USER-HANDLE from list of blocked users and unblock that user. | -| | mastodon-tl-unfilter-user-languages | Remove any language filters for USER-HANDLE. | -| | mastodon-tl-unfold-post | Unfold the toot at point if it is folded (read-more). | -| | mastodon-tl-unfollow-tag | Prompt for a followed tag, and unfollow it. | -| C-S-w | mastodon-tl-unfollow-user | Query for USER-HANDLE from current status and unfollow that user. | -| | mastodon-tl-unmute-thread | Unmute the thread displayed in the current buffer. | -| S-RET | mastodon-tl-unmute-user | Query for USER-HANDLE from list of muted users and unmute that user. | -| u, g | mastodon-tl-update | Update timeline with new toots. | -| = | mastodon-tl-view-first-full-image | From item byline, fetch load its first full image. | -| | mastodon-tl-view-full-image-at-point | Browse full-sized version of image at point in a new window. | -| | mastodon-tl-view-full-image-or-play-video | View full sized version of image at point, or try to play video. | -| | mastodon-tl-view-item-on-own-instance | Load current toot on your own instance. | -| | mastodon-tl-view-whole-thread | From a thread view, view entire thread. | -| t | mastodon-toot | Update instance with new toot. Content is captured in a new buffer. | -| C-c C-a | mastodon-toot-attach-media | Prompt for an attachment FILE with DESCRIPTION. | -| o | mastodon-toot-browse-toot-url | Browse URL of toot at point. | -| C-c C-k | mastodon-toot-cancel | Kill new-toot buffer/window. Does not POST content. | -| C-c C-v | mastodon-toot-change-visibility | Change the current visibility to the next valid value. | -| C-c ! | mastodon-toot-clear-all-attachments | Remove all attachments from a toot draft. | -| C-c C-o | mastodon-toot-clear-poll | Remove poll from toot compose buffer. | -| | mastodon-toot-copy-toot-text | Copy text of toot at point. | -| C | mastodon-toot-copy-toot-url | Copy URL of toot at point. | -| C-c C-p | mastodon-toot-create-poll | Prompt for new poll options and return as a list. | -| | mastodon-toot-delete-all-drafts | Delete all drafts. | -| D | mastodon-toot-delete-and-redraft-toot | Delete and redraft user's toot at point synchronously. | -| | 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-boosters | List the boosters of toot at point. | -| , | mastodon-toot-list-favouriters | List the favouriters of toot at point. | -| | mastodon-toot-mode | Minor mode for composing toots. | -| | mastodon-toot-open-draft-toot | Prompt for a draft and compose a toot with it. | -| 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. | -| C-c C-s | mastodon-toot-schedule-toot | Read a date (+ time) in the minibuffer and schedule the current toot. | -| C-c C-c | mastodon-toot-send | POST contents of new-toot buffer to fediverse instance and kill buffer. | -| C-c C-w | mastodon-toot-set-content-warning | Set a content warning for the current toot. | -| | mastodon-toot-set-default-visibility | Set the default visibility for toots on the server. | -| C-c C-l | mastodon-toot-set-toot-language | Prompt for a language and set `mastodon-toot--language'. | -| k | mastodon-toot-toggle-bookmark | Bookmark or unbookmark toot at point. | -| b | mastodon-toot-toggle-boost | Boost/unboost toot at `point'. | -| f | mastodon-toot-toggle-favourite | Favourite/unfavourite toot at `point'. | -| C-c C-n | mastodon-toot-toggle-nsfw | Toggle `mastodon-toot--content-nsfw'. | -| a | mastodon-toot-translate-toot-text | Translate text of toot at point. | -| E | mastodon-toot-view-toot-edits | View editing history of the toot at point in a popup buffer. | -| | mastodon-transient--prefix-inspect | Inspect a transient prefix's arguments and scope. | -| | mastodon-transient-choice-add | Add another poll choice if possible. | -| | mastodon-update-profile-note | Update current user profile note. | -| | mastodon-url-lookup | If a URL resembles a fediverse link, try to load in `mastodon.el'. | -| | mastodon-url-lookup-force | Call `mastodon-url-lookup' without checking if URL is fedi-like. | -| : | mastodon-user-settings | A transient for setting current user settings. | -| | mastodon-user-settings-update | Update current user settings on the server. | -| | 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-filter-kw | Add a keyword to filter 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. | -| | mastodon-views-cancel-scheduled-toot | Cancel the scheduled toot at point. | -| | mastodon-views-copy-scheduled-toot-text | Copy the text of the scheduled toot at point. | -| | mastodon-views-create-filter | Create a filter for a word. | -| | mastodon-views-create-list | Create a new list. | -| | mastodon-views-delete-filter | Delete filter at point. | -| | mastodon-views-delete-list | Prompt for a list and delete it. | -| | mastodon-views-delete-list-at-point | Delete list at point. | -| | mastodon-views-edit-list | Prompt for a list and edit the name and replies policy. | -| | mastodon-views-edit-list-at-point | Edit list at point. | -| | mastodon-views-edit-scheduled-as-new | Edit scheduled status as new toot. | -| | mastodon-views-instance-desc-misskey | Show instance description for a misskey/firefish server. | -| | mastodon-views-remove-account-from-list | Prompt for a list, select an account and remove from list. | -| | mastodon-views-remove-account-from-list-at-point | Prompt for account and remove from list at point. | -| | mastodon-views-remove-filter-kw | Remove keyword from filter at point. | -| | mastodon-views-reschedule-toot | Reschedule the scheduled toot at point. | -| | mastodon-views-update-filter | Update filter at point. | -| | mastodon-views-update-filter-kw | Update filter keyword. | -| I | mastodon-views-view-filters | View the user's filters in a new buffer. | -| R | mastodon-views-view-follow-requests | Open a new buffer displaying the user's follow requests. | -| G | mastodon-views-view-follow-suggestions | Display a buffer of suggested accounts to follow. | -| ; | mastodon-views-view-instance-description | View the details of the instance the current post's author is on. | -| | mastodon-views-view-instance-description-brief | View brief details of the instance the current post's author is on. | -| | mastodon-views-view-list-timeline | Prompt for a list and view its timeline. | -| X | mastodon-views-view-lists | Show the user's lists in a new buffer. | -| | mastodon-views-view-own-instance | View details of your own instance. | -| | mastodon-views-view-own-instance-brief | View brief details of your own instance. | -| S | mastodon-views-view-scheduled-toots | Show the user's scheduled toots in a new buffer. | -| | mastodon-views-view-timeline-list-at-point | View timeline of list at point. | +| Binding | Command | Description | +|------------+--------------------------------------------------+--------------------------------------------------------------------------------| +| C-c m m | mastodon | Connect client to `mastodon-instance-url' instance. | +| | mastodon-clear-poll | Clear current poll data. | +| | mastodon-create-poll | A transient for creating a poll. | +| | mastodon-create-poll-done | Finish setting poll details. | +| | mastodon-forget-all-logins | Delete `mastodon-client--token-file'. | +| | mastodon-image-mode | Major mode derived from `image-mode' by `define-derived-mode'. | +| | mastodon-inspect--get-search-account | Return JSON for a single account after search QUERY. | +| | mastodon-inspect--get-search-result | Inspect function for a search result for QUERY. | +| | mastodon-inspect--toot | Find next toot and dump its meta data into new buffer. | +| | mastodon-inspect--view-single-toot | View the toot/status represented by ITEM-ID. | +| | mastodon-inspect--view-single-toot-source | View the ess source of a toot/status represented by ITEM-ID. | +| 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 fediverse services using the Mastodon API. | +| | mastodon-notifications-clear-all | Clear all notifications. | +| C-k | mastodon-notifications-clear-current | Dismiss the notification at point. | +| C-c C-c | mastodon-notifications-cycle-type | Cycle the current notifications view. | +| a | mastodon-notifications-follow-request-accept | Accept a follow request. | +| j | mastodon-notifications-follow-request-reject | Reject a follow request. | +| C-c m n, N | mastodon-notifications-get | Display NOTIFICATIONS in buffer. | +| | mastodon-notifications-get-boosts | Display boost notifications in buffer. | +| | mastodon-notifications-get-edits | Display edited post notifications in buffer. | +| | mastodon-notifications-get-favourites | Display favourite notifications in buffer. | +| | mastodon-notifications-get-follow-requests | Display follow request notifications in buffer. | +| | mastodon-notifications-get-follows | Display follow notifications in buffer. | +| @ | mastodon-notifications-get-mentions | Display mention notifications in buffer. | +| | mastodon-notifications-get-polls | Display poll notifications in buffer. | +| | mastodon-notifications-get-single-notif | Return a single notification JSON for v2 notifs. | +| | mastodon-notifications-get-statuses | Display status notifications in buffer. | +| | mastodon-notifications-get-type | Read a notification type and load its timeline. | +| C-: | mastodon-notifications-policy | A transient to set notifications policy options. | +| | mastodon-notifications-policy-update | Send updated notification policy settings. | +| | mastodon-notifications-request-accept | Accept a notification request for a user. | +| | mastodon-notifications-request-reject | Reject a notification request for a user. | +| C-S-n | mastodon-notifications-requests | Open a new buffer displaying the user's notification requests. | +| | mastodon-profile-account-bot-toggle | Toggle the bot status of your account. | +| | mastodon-profile-account-discoverable-toggle | Toggle the discoverable status of your account. | +| | mastodon-profile-account-locked-toggle | Toggle the locked status of your account. | +| C-c C-s | mastodon-profile-account-search | Run a statuses search QUERY for the currently viewed account. | +| | mastodon-profile-account-sensitive-toggle | Toggle the sensitive status of your account. | +| C-c C-c | mastodon-profile-account-view-cycle | Cycle through profile view: toots, toot sans boosts, followers, and following. | +| | mastodon-profile-add-account-to-list | Add account of current profile buffer to a list. | +| | mastodon-profile-add-private-note-to-account | Add a private note to an account. | +| | mastodon-profile-fields | A transient for setting profile fields. | +| | mastodon-profile-fields-update | Update current user profile fields. | +| A | mastodon-profile-get-toot-author | Open profile of author of toot under point. | +| | mastodon-profile-mode | Toggle mastodon profile minor mode. | +| O | mastodon-profile-my-profile | Show the profile of the currently signed in user. | +| | 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 | Open a profile showing statuses. | +| | 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 without replies. | +| | mastodon-profile-open-statuses-only-media | Open a profile buffer showing only statuses with media. | +| C-c # | mastodon-profile-open-statuses-tagged | Prompt for a hashtag and display a profile with only statuses containing it. | +| | 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. | +| | mastodon-profile-show-familiar-followers | Show a list of familiar followers. | +| P | mastodon-profile-show-user | Query for USER-HANDLE from current status and show that user's profile. | +| | mastodon-profile-update-display-name | Update display name for your account. | +| | mastodon-profile-update-meta-fields | Prompt for new metadata fields information and PATCH the server. | +| | mastodon-profile-update-mode | Minor mode to update user profile. | +| C-c C-k | mastodon-profile-update-profile-note-cancel | Cancel updating user profile and kill buffer and window. | +| U | mastodon-profile-update-user-profile-note | Fetch user's profile note and display for editing. | +| C-c C-c | mastodon-profile-user-profile-send-updated | Send PATCH request with the updated profile note. | +| | mastodon-profile-view-account-private-note | Display the private note about a user. | +| K | mastodon-profile-view-bookmarks | Open a new buffer displaying the user's bookmarks. | +| V | mastodon-profile-view-favourites | Open a new buffer displaying the user's favourites. | +| | mastodon-profile-view-preferences | View user preferences in another window. | +| | mastodon-search-load-link-posts | Load timeline of posts containing link at point. | +| | mastodon-search-mode | Toggle mastodon search minor mode. | +| 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-links | Display a list of links trending on your instance. | +| | 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-switch-to-buffer | Switch to a live mastodon buffer. | +| | mastodon-tl-announcements | Display announcements from your instance. | +| | mastodon-tl-block-domain | Read a domain and block it. | +| 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'. | +| C | 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. | +| | mastodon-tl-do-link-action-at-point | Do the action of the link at POS. | +| | mastodon-tl-enable-notify-user-posts | Query for USER-HANDLE and enable notifications when they post. | +| | mastodon-tl-filter-user-user-posts-by-language | Query for USER-HANDLE and filter display of their posts by language. | +| | mastodon-tl-fold-post | Fold post at point, if it is too long. | +| ! | mastodon-tl-fold-post-toggle | Toggle the folding status of the toot at point. | +| | mastodon-tl-follow-tag | Prompt for a tag (from post at point) and follow it. | +| W | mastodon-tl-follow-user | Query for USER-HANDLE from current status and follow that user. | +| | mastodon-tl-follow-user-by-handle | Prompt for a USER-HANDLE 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 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. | +| \ | mastodon-tl-get-remote-local-timeline | Prompt for an instance domain and try to display its local timeline. | +| # | mastodon-tl-get-tag-timeline | Prompt for tag and opens its timeline. | +| n | mastodon-tl-goto-next-item | Jump to next item. | +| p | mastodon-tl-goto-prev-item | Jump to previous item. | +| C-" | mastodon-tl-jump-to-followed-tag | Prompt for a followed tag and view its timeline. | +| " | mastodon-tl-list-followed-tags | List followed tags. View timeline of tag user choses. | +| C-<return> | mastodon-tl-mpv-play-video-at-point | Play the video or gif at point with an mpv process. | +| | mastodon-tl-mpv-play-video-from-byline | Run `mastodon-tl-mpv-play-video-at-point' on first moving image in post. | +| | mastodon-tl-mute-thread | Mute the thread displayed in the current buffer. | +| M | mastodon-tl-mute-user | Query for USER-HANDLE from current status and mute that user. | +| | mastodon-tl-next-full-image | From full image view buffer, load the toot's next image. | +| TAB | mastodon-tl-next-tab-item | Move to the next interesting item. | +| M-; | mastodon-tl-nodeinfo-for-toot | Return Nodeinfo for toot at point. | +| v | mastodon-tl-poll-vote | If there is a poll at point, prompt user for OPTION to vote on it. | +| | mastodon-tl-prev-full-image | From full image view buffer, load the toot's prev image. | +| C-M-i | mastodon-tl-previous-tab-item | Move to the previous interesting item. | +| | mastodon-tl-remote-tag-timeline | Call `mastodon-tl-get-remote-local-timeline' but for a TAG timeline. | +| Z | mastodon-tl-report-to-mods | Report the author of the toot at point to your instance moderators. | +| RET | mastodon-tl-return | Load user profile or thread of item at point. | +| SPC | mastodon-tl-scroll-up-command | Call `scroll-up-command', loading more toots if necessary. | +| | mastodon-tl-shr-browse-image | Browse the image under point. | +| | mastodon-tl-some-followed-tags-timeline | Prompt for some tags, and open a timeline for them. | +| C-' | mastodon-tl-tag-group-timeline | Load a timeline of a tag group from `mastodon-tl--tags-groups'. | +| T | mastodon-tl-thread | Open thread buffer for toot at point. | +| S | mastodon-tl-toggle-sensitive-image | Toggle dislay of sensitive image at point. | +| | mastodon-tl-toggle-spoiler-in-thread | Toggler content warning for all posts in current thread. | +| c | mastodon-tl-toggle-spoiler-text-in-toot | Toggle the visibility of the spoiler text in the current toot. | +| | mastodon-tl-unblock-domain | Read a blocked domain and unblock it. | +| C-S-b | mastodon-tl-unblock-user | Query for USER-HANDLE from list of blocked users and unblock that user. | +| | mastodon-tl-unfilter-user-languages | Remove any language filters for USER-HANDLE. | +| | mastodon-tl-unfold-post | Unfold the toot at point if it is folded (read-more). | +| | mastodon-tl-unfollow-tag | Prompt for a followed tag, and unfollow it. | +| C-S-w | mastodon-tl-unfollow-user | Query for USER-HANDLE from current status and unfollow that user. | +| | mastodon-tl-unmute-thread | Unmute the thread displayed in the current buffer. | +| S-RET | mastodon-tl-unmute-user | Query for USER-HANDLE from list of muted users and unmute that user. | +| u | mastodon-tl-update | Update timeline with new toots. | +| = | mastodon-tl-view-first-full-image | From item byline, fetch load its first full image. | +| | mastodon-tl-view-full-image-at-point | Browse full-sized version of image at point in a new window. | +| RET | mastodon-tl-view-full-image-or-play-video | View full sized version of image at point, or try to play video. | +| | mastodon-tl-view-item-on-own-instance | Load current toot on your own instance. | +| | mastodon-tl-view-single-toot | View toot at point in a separate buffer. | +| | mastodon-tl-view-whole-thread | From a thread view, view entire thread. | +| C-c m t, t | mastodon-toot | Update instance with new toot. Content is captured in a new buffer. | +| C-c C-a | mastodon-toot-attach-media | Prompt for an attachment FILE with DESCRIPTION. | +| o | mastodon-toot-browse-toot-url | Browse URL of toot at point. | +| C-c C-k | mastodon-toot-cancel | Kill new-toot buffer/window. Does not POST content. | +| C-c C-v | mastodon-toot-change-visibility | Change the current visibility to the next valid value. | +| C-c ! | mastodon-toot-clear-all-attachments | Remove all attachments from a toot draft. | +| C-c C-o | mastodon-toot-clear-poll | Remove poll from toot compose buffer. | +| | mastodon-toot-copy-toot-text | Copy text of toot at point. | +| C | mastodon-toot-copy-toot-url | Copy URL of toot at point. | +| C-c C-p | mastodon-toot-create-poll | Prompt for new poll options and return as a list. | +| | mastodon-toot-delete-all-drafts | Delete all drafts. | +| D | mastodon-toot-delete-and-redraft-toot | Delete and redraft user's toot at point synchronously. | +| | 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-boosters | List the boosters of toot at point. | +| , | mastodon-toot-list-favouriters | List the favouriters of toot at point. | +| | mastodon-toot-mode | Minor mode for composing toots. | +| | mastodon-toot-open-draft-toot | Prompt for a draft and compose a toot with it. | +| 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. | +| C-c C-s | mastodon-toot-schedule-toot | Read a date (+ time) in the minibuffer and schedule the current toot. | +| C-c C-c | mastodon-toot-send | POST contents of new-toot buffer to fediverse instance and kill buffer. | +| C-c C-w | mastodon-toot-set-content-warning | Set a content warning for the current toot. | +| | mastodon-toot-set-default-visibility | Set the default visibility for toots on the server. | +| C-c C-l | mastodon-toot-set-toot-language | Prompt for a language and set `mastodon-toot--language'. | +| k | mastodon-toot-toggle-bookmark | Bookmark or unbookmark toot at point. | +| b | mastodon-toot-toggle-boost | Boost/unboost toot at `point'. | +| f | mastodon-toot-toggle-favourite | Favourite/unfavourite toot at `point'. | +| C-c C-n | mastodon-toot-toggle-nsfw | Toggle `mastodon-toot--content-nsfw'. | +| a | mastodon-toot-translate-toot-text | Translate text of toot at point. | +| E | mastodon-toot-view-toot-edits | View editing history of the toot at point in a popup buffer. | +| | mastodon-transient--prefix-inspect | Inspect a transient prefix's arguments and scope. | +| | mastodon-transient-choice-add | Add another poll choice if possible. | +| | mastodon-update-profile-note | Update current user profile note. | +| C-c m u | mastodon-url-lookup | If a URL resembles a fediverse link, try to load in `mastodon.el'. | +| | mastodon-url-lookup-force | Call `mastodon-url-lookup' without checking if URL is fedi-like. | +| : | mastodon-user-settings | A transient for setting current user settings. | +| | mastodon-user-settings-update | Update current user settings on the server. | +| A | 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. | +| a | mastodon-views-add-filter-kw | Add a keyword to filter 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. | +| c | mastodon-views-cancel-scheduled-toot | Cancel the scheduled toot at point. | +| | mastodon-views-copy-scheduled-toot-text | Copy the text of the scheduled toot at point. | +| c | mastodon-views-create-filter | Create a filter for a word. | +| C | mastodon-views-create-list | Create a new list. | +| k | mastodon-views-delete-filter | Delete filter at point. | +| D | mastodon-views-delete-list | Prompt for a list and delete it. | +| | mastodon-views-delete-list-at-point | Delete list at point. | +| E | mastodon-views-edit-list | Prompt for a list and edit the name and replies policy. | +| | mastodon-views-edit-list-at-point | Edit list at point. | +| RET | mastodon-views-edit-scheduled-as-new | Edit scheduled status as new toot. | +| | mastodon-views-instance-desc-misskey | Show instance description for a misskey/firefish server. | +| R | mastodon-views-remove-account-from-list | Prompt for a list, select an account and remove from list. | +| | mastodon-views-remove-account-from-list-at-point | Prompt for account and remove from list at point. | +| r | mastodon-views-remove-filter-kw | Remove keyword from filter at point. | +| r | mastodon-views-reschedule-toot | Reschedule the scheduled toot at point. | +| u | mastodon-views-update-filter | Update filter at point. | +| U | mastodon-views-update-filter-kw | Update filter keyword. | +| I, g | mastodon-views-view-filters | View the user's filters in a new buffer. | +| g, R | mastodon-views-view-follow-requests | Open a new buffer displaying the user's follow requests. | +| g, G | mastodon-views-view-follow-suggestions | Display a buffer of suggested accounts to follow. | +| ; | mastodon-views-view-instance-description | View the details of the instance the current post's author is on. | +| | mastodon-views-view-instance-description-brief | View brief details of the instance the current post's author is on. | +| | mastodon-views-view-list-timeline | Prompt for a list and view its timeline. | +| g, X | mastodon-views-view-lists | Show the user's lists in a new buffer. | +| | mastodon-views-view-own-instance | View details of your own instance. | +| | mastodon-views-view-own-instance-brief | View brief details of your own instance. | +| g, S | mastodon-views-view-scheduled-toots | Show the user's scheduled toots in a new buffer. | +| | mastodon-views-view-timeline-list-at-point | View timeline of list at point. | * mastodon custom variables index diff --git a/test/mastodon-http-tests.el b/test/mastodon-http-tests.el index 4bef0eefe7..82497ba174 100644 --- a/test/mastodon-http-tests.el +++ b/test/mastodon-http-tests.el @@ -62,7 +62,7 @@ Strict-Transport-Security: max-age=31536000 (let ((response-buffer (get-buffer-create "mastodon-http--triage-buffer"))) (with-mock - (mock (url-http-parse-response) => 200) + (mock (mastodon-http--response-status response-buffer) => 200) (with-current-buffer response-buffer (erase-buffer) (insert mastodon-http--example-200)) @@ -78,7 +78,7 @@ Strict-Transport-Security: max-age=31536000 (let ((response-buffer (get-buffer-create "mastodon-http--triage-buffer"))) (with-mock - (mock (url-http-parse-response) => 444) + (mock (mastodon-http--response-status response-buffer) => 444) (with-current-buffer response-buffer (erase-buffer) (insert mastodon-http--example-400)) diff --git a/test/mastodon-media-tests.el b/test/mastodon-media-tests.el index 5633ca346b..e9722dd3d8 100644 --- a/test/mastodon-media-tests.el +++ b/test/mastodon-media-tests.el @@ -1,12 +1,23 @@ ;;; mastodon-media-test.el --- Tests for mastodon-media.el -*- lexical-binding: nil -*- +;; non interactive failures: +;; FAILED mastodon-media--get-avatar-rendering +;; FAILED mastodon-media--load-image-from-url-avatar-with-imagemagic +;; FAILED mastodon-media--load-image-from-url-media-link-with-imagemagic +;; FAILED mastodon-media--load-image-from-url-media-link-without-imagemagic +;; FAILED mastodon-media--load-image-from-url-url-fetching-fails + (require 'el-mock) (ert-deftest mastodon-media--get-avatar-rendering () "Should return text with all expected properties." (with-mock ;; (mock (image-type-available-p 'imagemagick) => t) - (mock (create-image * (when (version< emacs-version "27.1") 'imagemagick) t :height 123) => :mock-image) + (mock (create-image * + (when (version< emacs-version "27.1") 'imagemagick) + t + :height 123) ;; FIXME: fails non-interactively, is nil + => :mock-image) (let* ((mastodon-media--avatar-height 123) (result (mastodon-media--get-avatar-rendering "http://example.org/img.png")) @@ -39,7 +50,7 @@ (should (string= "http://example.org/remote/img.png" (plist-get properties 'image-url))) (should (eq mastodon-tl--shr-image-map-replacement (plist-get properties 'keymap))) (should (string= "image" (plist-get properties 'mastodon-media-type))) - (should (string= "RET/i: load full image (prefix: copy URL), +/-: zoom, r: rotate, o: save preview, S: toggle sensitive media" + (should (string= "RET: load full image or play video, i for image options, S: toggle sensitive media" (plist-get properties 'help-echo)))))) (ert-deftest mastodon-media:get-media-link-rendering-gif () @@ -63,7 +74,7 @@ (should (string= "http://example.org/remote/img.png" (plist-get properties 'image-url))) (should (eq mastodon-tl--shr-image-map-replacement (plist-get properties 'keymap))) (should (string= "gifv" (plist-get properties 'mastodon-media-type))) - (should (string= "RET/i: load full image (prefix: copy URL), +/-: zoom, r: rotate, o: save preview, S: toggle sensitive media\nC-RET: play gifv with mpv" + (should (string= "RET: load full image or play video, i for image options, S: toggle sensitive media\nC-RET: play gifv with mpv" (plist-get properties 'help-echo)))))) (ert-deftest mastodon-media--load-image-from-url-avatar-with-imagemagic () @@ -75,12 +86,13 @@ (mock (create-image * (when (version< emacs-version "27.1") 'imagemagick) - t :height 123) => '(image foo)) + t :height 123) + => '(image foo)) (mock (copy-marker 7) => :my-marker ) (mock (url-retrieve url #'mastodon-media--process-image-response - `(:my-marker (:height 123) 1 ,url)) + `(,url :my-marker (:height 123) 1)) => :called-as-expected) (with-temp-buffer @@ -101,7 +113,7 @@ (mock (url-retrieve url #'mastodon-media--process-image-response - `(:my-marker () 1 ,url)) + `(,url :my-marker () 1)) => :called-as-expected) (with-temp-buffer @@ -121,14 +133,17 @@ (mock (url-retrieve "http://example.org/image.png" #'mastodon-media--process-image-response - '(:my-marker (:max-height 321) 5 "http://example.org/image.png")) + '("http://example.org/image.png" :my-marker + (:max-height 321) ;; FIXME: fails non-interactively: is nil + 5)) => :called-as-expected) (with-temp-buffer (insert (concat "Start:" (mastodon-media--get-media-link-rendering url) ":rest")) (let ((mastodon-media--preview-max-height 321)) - (should (eq :called-as-expected (mastodon-media--load-image-from-url url 'media-link 7 5)))))))) + (should (eq :called-as-expected + (mastodon-media--load-image-from-url url 'media-link 7 5)))))))) (ert-deftest mastodon-media--load-image-from-url-media-link-without-imagemagic () "Should make the right call to url-retrieve." @@ -136,12 +151,14 @@ (with-mock ;; (mock (image-type-available-p 'imagemagick) => nil) ;; (mock (image-transforms-p) => nil) - (mock (create-image * nil t) => '(image foo)) + (mock (create-image * nil t :height 20) => '(image foo)) (mock (copy-marker 7) => :my-marker ) (mock (url-retrieve "http://example.org/image.png" #'mastodon-media--process-image-response - '(:my-marker () 5 "http://example.org/image.png")) + '("http://example.org/image.png" :my-marker + (:max-height 321) ;; FIXME: fails non-interactively: is nil + 5)) => :called-as-expected) (with-temp-buffer @@ -160,7 +177,9 @@ (mock (create-image * (when (version< emacs-version "27.1") 'imagemagick) - t :height 123) => '(image foo)) + t + :height 123) ;; FIXME: fails non-interactively, is nil + => '(image foo)) (stub url-retrieve => (error "url-retrieve failed")) (with-temp-buffer @@ -201,7 +220,7 @@ t ':image :option) => :fake-image) (mastodon-media--process-image-response - () used-marker '(:image :option) 1 "http://example.org/image.png") + () "http://example.org/image.png" used-marker '(:image :option) 1) ;; the used marker has been unset: (should (null (marker-position used-marker))) diff --git a/test/mastodon-profile-tests.el b/test/mastodon-profile-tests.el index 289e8d97a1..efacd2ceec 100644 --- a/test/mastodon-profile-tests.el +++ b/test/mastodon-profile-tests.el @@ -122,48 +122,51 @@ When formatting Gargon's state we want to see - the url of the avatar (yet to be loaded) - the info attached to the name" (with-mock - ;; Don't start any image loading: - (mock (mastodon-media--inline-images * *) => nil) - ;; Let's not do formatting as that makes it hard to not rely on - ;; window width and reflowing the text. - (mock (shr-render-region * *) => nil) - (if (version< emacs-version "27.1") - (mock (image-type-available-p 'imagemagick) => t) - (mock (image-transforms-p) => t)) + ;; Don't start any image loading: + (mock (mastodon-media--inline-images * *) => nil) + ;; Let's not do formatting as that makes it hard to not rely on + ;; window width and reflowing the text. + (mock (shr-render-region * *) => nil) + (if (version< emacs-version "27.1") + (mock (image-type-available-p 'imagemagick) => t) + (mock (image-transforms-p) => t)) - (with-temp-buffer - (let ((mastodon-tl--show-avatars t) - (mastodon-tl--display-media-p t)) - (mastodon-profile--format-user (list gargron-profile-json))) + (with-temp-buffer + (let ((mastodon-tl--show-avatars t) + (mastodon-tl--display-media-p t) + (username (mastodon-tl--unicode-wrap "Eugen")) + (handle (mastodon-tl--unicode-wrap "@Gargron"))) + (mastodon-profile--format-user (list gargron-profile-json)) - (should - (equal - (buffer-substring-no-properties (point-min) (point-max)) - "\n Eugen (@Gargron)\n<p>Developer of Mastodon and administrator of mastodon.social. I post service announcements, development updates, and personal stuff.</p>\n")) + (should + (equal + (buffer-substring-no-properties (point-min) (point-max)) + (format "\n %s (%s)\n<p>Developer of Mastodon and administrator of mastodon.social. I post service announcements, development updates, and personal stuff.</p>\n" + username handle))) - ;; Check the avatar at pos 2 - (should - (equal - (get-text-property 2 'media-url) - "https://files.mastodon.social/accounts/avatars/000/000/001/original/d96d39a0abb45b92.jpg")) - (should - (equal - (get-text-property 2 'media-state) - 'needs-loading)) + ;; Check the avatar at pos 2 + (should + (equal + (get-text-property 2 'media-url) + "https://files.mastodon.social/accounts/avatars/000/000/001/original/d96d39a0abb45b92.jpg")) + (should + (equal + (get-text-property 2 'media-state) + 'needs-loading)) - ;; Check the byline state - (should - (equal - (get-text-property 4 'byline) - t)) - (should - (equal - (get-text-property 4 'item-id) - (alist-get 'id gargron-profile-json))) - (should - (equal - (get-text-property 4 'item-json) - gargron-profile-json))))) + ;; Check the byline state + (should + (equal + (get-text-property 4 'byline) + t)) + (should + (equal + (get-text-property 4 'item-id) + (alist-get 'id gargron-profile-json))) + (should + (equal + (get-text-property 4 'item-json) + gargron-profile-json)))))) (ert-deftest mastodon-profile--search-account-by-handle--removes-at () "Should ignore a leading at-sign in user handle. diff --git a/test/mastodon-tl-tests.el b/test/mastodon-tl-tests.el index 6078cf2927..1d01fee2f0 100644 --- a/test/mastodon-tl-tests.el +++ b/test/mastodon-tl-tests.el @@ -359,7 +359,9 @@ Strict-Transport-Security: max-age=31536000 (ert-deftest mastodon-tl--byline-regular () "Should format the regular toot correctly." (let ((mastodon-tl--show-avatars-p nil) - (timestamp (cdr (assoc 'created_at mastodon-tl-test-base-toot)))) + (timestamp (cdr (assoc 'created_at mastodon-tl-test-base-toot))) + (username (mastodon-tl--unicode-wrap "Account 42")) + (handle (mastodon-tl--unicode-wrap "@acct42@example.space"))) (with-mock (mock (date-to-time timestamp) => '(22782 21551)) (mock (mastodon-tl--toot-stats mastodon-tl-test-base-toot) => "") @@ -369,10 +371,8 @@ Strict-Transport-Security: max-age=31536000 (handle-location 20)) (should (string= (substring-no-properties byline) - (concat "Account 42 (@acct42@example.space) 2999-99-99 00:11:22 - " - mastodon-tl--horiz-bar " -"))) + (format "%s (%s) 2999-99-99 00:11:22\n %s\n" + username handle mastodon-tl--horiz-bar))) (should (eq (get-text-property handle-location 'mastodon-tab-stop byline) 'user-handle)) (should (string= (get-text-property handle-location 'mastodon-handle byline) @@ -383,7 +383,9 @@ Strict-Transport-Security: max-age=31536000 (ert-deftest mastodon-tl--byline-regular-with-avatar () "Should format the regular toot correctly." (let ((mastodon-tl--show-avatars-p t) - (timestamp (cdr (assoc 'created_at mastodon-tl-test-base-toot)))) + (timestamp (cdr (assoc 'created_at mastodon-tl-test-base-toot))) + (username (mastodon-tl--unicode-wrap "Account 42")) + (handle (mastodon-tl--unicode-wrap "@acct42@example.space"))) (with-mock (stub create-image => '(image "fake data")) (mock (date-to-time timestamp) => '(22782 21551)) @@ -392,16 +394,16 @@ Strict-Transport-Security: max-age=31536000 (should (string= (substring-no-properties (mastodon-tl--byline mastodon-tl-test-base-toot)) - (concat "Account 42 (@acct42@example.space) 2999-99-99 00:11:22 - " - mastodon-tl--horiz-bar " -")))))) + (format "%s (%s) 2999-99-99 00:11:22\n %s\n" + username handle mastodon-tl--horiz-bar)))))) (ert-deftest mastodon-tl--byline-boosted () "Should format the boosted toot correctly." (let* ((mastodon-tl--show-avatars-p nil) (toot (cons '(reblogged . t) mastodon-tl-test-base-toot)) - (timestamp (cdr (assoc 'created_at toot)))) + (timestamp (cdr (assoc 'created_at toot))) + (username (mastodon-tl--unicode-wrap "Account 42")) + (handle (mastodon-tl--unicode-wrap "@acct42@example.space"))) (with-mock (mock (date-to-time timestamp) => '(22782 21551)) (mock (mastodon-tl--symbol 'boost) => "B") @@ -410,16 +412,16 @@ Strict-Transport-Security: max-age=31536000 (should (string= (substring-no-properties (mastodon-tl--byline toot)) - (concat "(B) Account 42 (@acct42@example.space) 2999-99-99 00:11:22 - " - mastodon-tl--horiz-bar " -")))))) + (format "(B) %s (%s) 2999-99-99 00:11:22\n %s\n" + username handle mastodon-tl--horiz-bar)))))) (ert-deftest mastodon-tl--byline-favorited () "Should format the favourited toot correctly." (let* ((mastodon-tl--show-avatars-p nil) (toot (cons '(favourited . t) mastodon-tl-test-base-toot)) - (timestamp (cdr (assoc 'created_at toot)))) + (timestamp (cdr (assoc 'created_at toot))) + (username (mastodon-tl--unicode-wrap "Account 42")) + (handle (mastodon-tl--unicode-wrap "@acct42@example.space"))) (with-mock (mock (mastodon-tl--symbol 'favourite) => "F") (mock (date-to-time timestamp) => '(22782 21551)) @@ -428,17 +430,17 @@ Strict-Transport-Security: max-age=31536000 (should (string= (substring-no-properties (mastodon-tl--byline toot)) - (concat "(F) Account 42 (@acct42@example.space) 2999-99-99 00:11:22 - " - mastodon-tl--horiz-bar " -")))))) + (format "(F) %s (%s) 2999-99-99 00:11:22\n %s\n" + username handle mastodon-tl--horiz-bar)))))) (ert-deftest mastodon-tl--byline-boosted/favorited () "Should format the boosted & favourited toot correctly." (let* ((mastodon-tl--show-avatars-p nil) (toot `((favourited . t) (reblogged . t) ,@mastodon-tl-test-base-toot)) - (timestamp (cdr (assoc 'created_at toot)))) + (timestamp (cdr (assoc 'created_at toot))) + (username (mastodon-tl--unicode-wrap "Account 42")) + (handle (mastodon-tl--unicode-wrap "@acct42@example.space"))) (with-mock (mock (mastodon-tl--toot-stats toot) => "") (mock (date-to-time timestamp) => '(22782 21551)) @@ -450,10 +452,8 @@ Strict-Transport-Security: max-age=31536000 (should (string= (substring-no-properties (mastodon-tl--byline toot)) - (concat "(?) (?) Account 42 (@acct42@example.space) 2999-99-99 00:11:22 - " - mastodon-tl--horiz-bar " -")))))) + (format "(?) (?) %s (%s) 2999-99-99 00:11:22\n %s\n" + username handle mastodon-tl--horiz-bar)))))) ;; FIXME: In recent mastodon versions the `mastodon-tl--byline' behavior changed ;; as well as the reblogged behavior, and as a result this test behaves similar @@ -497,7 +497,9 @@ Strict-Transport-Security: max-age=31536000 (toot mastodon-tl-test-base-boosted-toot) (original-toot (cdr (assoc 'reblog mastodon-tl-test-base-boosted-toot))) (timestamp (cdr (assoc 'created_at toot))) - (original-timestamp (cdr (assoc 'created_at original-toot)))) + (original-timestamp (cdr (assoc 'created_at original-toot))) + (username (mastodon-tl--unicode-wrap "Account 43")) + (handle (mastodon-tl--unicode-wrap "@acct43@example.space"))) (with-mock ;; We don't expect to use the toot's timestamp but the timestamp of the ;; reblogged toot: @@ -510,17 +512,18 @@ Strict-Transport-Security: max-age=31536000 (should (string= (substring-no-properties (mastodon-tl--byline toot)) - (concat "Account 43 (@acct43@example.space) original time - " mastodon-tl--horiz-bar " -")))))) + (format "%s (%s) original time\n %s\n" + username handle mastodon-tl--horiz-bar)))))) (ert-deftest mastodon-tl--byline-reblogged-boosted/favorited () - "Should format the reblogged toot that was also boosted & favoritedcorrectly." + "Should format the reblogged toot that was also boosted & favorited correctly." (let* ((mastodon-tl--show-avatars-p nil) (toot `((favourited . t) (reblogged . t) ,@mastodon-tl-test-base-boosted-toot)) (original-toot (cdr (assoc 'reblog mastodon-tl-test-base-boosted-toot))) (timestamp (cdr (assoc 'created_at toot))) - (original-timestamp (cdr (assoc 'created_at original-toot)))) + (original-timestamp (cdr (assoc 'created_at original-toot))) + (username (mastodon-tl--unicode-wrap "Account 43")) + (handle (mastodon-tl--unicode-wrap "@acct43@example.space"))) (with-mock ;; We don't expect to use the toot's timestamp but the timestamp of the ;; reblogged toot: @@ -536,9 +539,8 @@ Strict-Transport-Security: max-age=31536000 (should (string= (substring-no-properties (mastodon-tl--byline toot)) - (concat "Account 43 (@acct43@example.space) original time - " mastodon-tl--horiz-bar " -")))))) + (format "%s (%s) original time\n %s\n" + username handle mastodon-tl--horiz-bar)))))) (ert-deftest mastodon-tl--byline-timestamp-has-relative-display () "Should display the timestamp with a relative time." @@ -565,7 +567,8 @@ Strict-Transport-Security: max-age=31536000 "Should not fail when display_name is nil." (let* ((mastodon-tl--show-avatars-p nil) (toot (cons '(reblogged . t) mastodon-tl-test-empty-display-name)) - (timestamp (cdr (assoc 'created_at toot)))) + (timestamp (cdr (assoc 'created_at toot))) + (handle (mastodon-tl--unicode-wrap "@acct42@example.space"))) (with-mock (mock (date-to-time timestamp) => '(22782 21551)) (mock (mastodon-tl--symbol 'boost) => "B") @@ -574,10 +577,8 @@ Strict-Transport-Security: max-age=31536000 (should (string= (substring-no-properties (mastodon-tl--byline toot)) - (concat "(B) acct42 (@acct42@example.space) 2999-99-99 00:11:22 - " - mastodon-tl--horiz-bar " -")))))) + (format "(B) acct42 (%s) 2999-99-99 00:11:22\n %s\n" + handle mastodon-tl--horiz-bar)))))) (ert-deftest mastodon-tl--consider-timestamp-for-updates-no-active-callback () "Should update the timestamp update variables as expected." @@ -1130,7 +1131,8 @@ correct value for following, as well as notifications enabled or disabled." (url-mute "https://instance.url/accounts/123456789/mute") (url-block "https://instance.url/accounts/123456789/block") (url-true "https://instance.url/accounts/123456789/follow?notify=true") - (url-false "https://instance.url/accounts/123456789/follow?notify=false")) + (url-false "https://instance.url/accounts/123456789/follow?notify=false") + (handle (concat "@" user-handle))) (with-temp-buffer (let ((response-buffer-true (current-buffer))) (insert mastodon-tl--follow-notify-true-response) @@ -1143,7 +1145,7 @@ correct value for following, as well as notifications enabled or disabled." user-name user-handle "follow") - "User some-user (@some-u...@instance.url) followed!"))))) + (format "User %s (%s) %s!" user-name handle "followed")))))) (with-temp-buffer (let ((response-buffer-true (current-buffer))) (insert mastodon-tl--follow-notify-true-response) @@ -1156,7 +1158,7 @@ correct value for following, as well as notifications enabled or disabled." user-name user-handle "mute") - "User some-user (@some-u...@instance.url) muted!"))))) + (format "User %s (%s) %s!" user-name handle "muted")))))) (with-temp-buffer (let ((response-buffer-true (current-buffer))) (insert mastodon-tl--follow-notify-true-response) @@ -1169,7 +1171,7 @@ correct value for following, as well as notifications enabled or disabled." user-name user-handle "block") - "User some-user (@some-u...@instance.url) blocked!"))))) + (format "User %s (%s) %s!" user-name handle "blocked")))))) (with-temp-buffer (let ((response-buffer-true (current-buffer))) (insert mastodon-tl--follow-notify-true-response) @@ -1184,7 +1186,8 @@ correct value for following, as well as notifications enabled or disabled." user-handle "follow" "true") - "Receiving notifications for user some-user (@some-u...@instance.url)!")))))) + (format "Receiving notifications for user %s (%s)!" + user-name handle))))))) (with-temp-buffer (let ((response-buffer-false (current-buffer))) (insert mastodon-tl--follow-notify-false-response) @@ -1198,7 +1201,8 @@ correct value for following, as well as notifications enabled or disabled." user-handle "follow" "false") - "Not receiving notifications for user some-user (@some-u...@instance.url)!"))))))) + (format "Not receiving notifications for user %s (%s)!" + user-name handle)))))))) (ert-deftest mastodon-tl--report-to-mods-params-alist () "" diff --git a/test/mastodon-toot-tests.el b/test/mastodon-toot-tests.el index 7d5da284e6..2330d80a2a 100644 --- a/test/mastodon-toot-tests.el +++ b/test/mastodon-toot-tests.el @@ -209,7 +209,7 @@ mention string." (toot mastodon-toot-test-base-toot) (id 61208)) (with-mock - (mock (url-http-parse-response) => 200) + (mock (mastodon-http--response-status pin-response) => 200) (mock (mastodon-tl--property 'base-item-id) => id) (mock (mastodon-http--api "statuses/61208/pin") => "https://example.space/statuses/61208/pin")