From 71c68ba64c5be9d6bcf473d46aea2c0977b80048 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Fri, 4 Oct 2024 11:42:52 +0200 Subject: add images in notifs customize --- lisp/mastodon-tl.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 4058abc..f8088e6 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -96,6 +96,7 @@ (defvar mastodon-toot--visibility) (defvar mastodon-toot-mode) (defvar mastodon-active-user) +(defvar mastodon-notifications--images-in-notifs) (when (require 'mpv nil :no-error) (declare-function mpv-start "mpv")) @@ -1184,7 +1185,12 @@ SENSITIVE is a flag from the item's JSON data." .description) .description) .preview_url))) - (if mastodon-tl--display-media-p + (if (and mastodon-tl--display-media-p + ;; if in notifs, also check notifs images custom: + (if (or (mastodon-tl--buffer-type-eq 'notifications) + (mastodon-tl--buffer-type-eq 'mentions)) + mastodon-notifications--images-in-notifs + t)) (mastodon-media--get-media-link-rendering ; placeholder: "[img]" .preview_url (or .remote_url .url) ; for shr-browse-url .type .description sensitive) -- cgit v1.2.3 From ba6e06361655398144b1cbb9005eb4846f0f3d70 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Fri, 4 Oct 2024 11:43:09 +0200 Subject: move call to mastodon-media--inline-images from tl--insert-status to tl--timeline, so its called once per timeline not once per status! --- lisp/mastodon-tl.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index f8088e6..1068a8c 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1538,8 +1538,7 @@ THREAD means the status will be displayed in a thread view. When DOMAIN, force inclusion of user's domain in their handle. UNFOLDED is a boolean meaning whether to unfold or fold item if foldable. NO-BYLINE means just insert toot body, used for folding." - (let* ((start-pos (point)) - (reply-to-id (alist-get 'in_reply_to_id toot)) + (let* ((reply-to-id (alist-get 'in_reply_to_id toot)) (after-reply-status-p (when (and thread reply-to-id) (mastodon-tl--after-reply-status reply-to-id))) @@ -1587,10 +1586,7 @@ NO-BYLINE means just insert toot body, used for folding." 'notification-type type 'toot-foldable toot-foldable 'toot-folded (and toot-foldable (not unfolded))) - (if no-byline "" "\n")) - ;; media: - (when mastodon-tl--display-media-p - (mastodon-media--inline-images start-pos (point))))) + (if no-byline "" "\n")))) (defun mastodon-tl--is-reply (toot) "Check if the TOOT is a reply to another one (and not boosted). @@ -1668,7 +1664,8 @@ NO-BYLINE means just insert toot body, used for folding." This function removes replies if user required. THREAD means the status will be displayed in a thread view. When DOMAIN, force inclusion of user's domain in their handle." - (let ((toots ;; hack to *not* filter replies on profiles: + (let ((start-pos (point)) + (toots ;; hack to *not* filter replies on profiles: (if (eq (mastodon-tl--get-buffer-type) 'profile-statuses) toots (if (or ; we were called via --more*: @@ -1680,6 +1677,9 @@ When DOMAIN, force inclusion of user's domain in their handle." (mapc (lambda (toot) (mastodon-tl--toot toot nil thread domain)) toots) + ;; media: + (when mastodon-tl--display-media-p + (mastodon-media--inline-images start-pos (point))) (goto-char (point-min)))) ;;; FOLDING -- cgit v1.2.3 From 1c1a195b09c995b2a1f17dcc3f6830e7f0737c69 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Fri, 4 Oct 2024 16:09:28 +0200 Subject: fix display/links of Media: links with captions --- lisp/mastodon-tl.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 1068a8c..2e0588f 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1183,8 +1183,9 @@ SENSITIVE is a flag from the item's JSON data." (concat "Media:: " (if (and mastodon-tl--display-caption-not-url-when-no-media .description) - .description) - .preview_url))) + .description + .preview_url))) + (remote-url (or .remote_url .url))) (if (and mastodon-tl--display-media-p ;; if in notifs, also check notifs images custom: (if (or (mastodon-tl--buffer-type-eq 'notifications) @@ -1192,12 +1193,12 @@ SENSITIVE is a flag from the item's JSON data." mastodon-notifications--images-in-notifs t)) (mastodon-media--get-media-link-rendering ; placeholder: "[img]" - .preview_url (or .remote_url .url) ; for shr-browse-url + .preview_url remote-url ; for shr-browse-url .type .description sensitive) ;; return URL/caption: (concat (mastodon-tl--propertize-img-str-or-url (concat "Media:: " .preview_url) ; string - .preview_url .remote_url .type .description + .preview_url remote-url .type .description display-str 'shr-link .description sensitive) "\n"))))) @@ -1220,7 +1221,7 @@ SENSITIVE is a flag from the item's JSON data." 'face face 'mouse-face 'highlight 'mastodon-tab-stop 'image ; for do-link-action-at-point - 'image-url full-remote-url ; for shr-browse-image + 'image-url (or full-remote-url media-url) ; for shr-browse-image 'keymap mastodon-tl--shr-image-map-replacement 'image-description caption 'sensitive sensitive -- cgit v1.2.3 From 353afcad0f2a6802719eb987be6de861de3e2e8e Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 10 Oct 2024 11:39:50 +0200 Subject: WIP. display fediverse account of link authors if available. --- lisp/mastodon-tl.el | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 2e0588f..3f06756 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -875,17 +875,46 @@ links in the text. If TOOT is nil no parsing occurs." 0 (- (window-width) 3))))) (shr-render-region (point-min) (point-max))) - ;; Make all links a tab stop recognized by our own logic, make things point - ;; to our own logic (e.g. hashtags), and update keymaps where needed: + ;; Make all links a tab stop recognized by our own logic, make + ;; things point to our own logic (e.g. hashtags), and update keymaps + ;; where needed: (when toot (let (region) (while (setq region (mastodon-tl--find-property-range 'shr-url (or (cdr region) (point-min)))) (mastodon-tl--process-link toot (car region) (cdr region) - (get-text-property (car region) 'shr-url))))) + (get-text-property (car region) 'shr-url)) + (when (proper-list-p toot) ;; not on profile fields cons cells + (let* ((card (alist-get 'card toot)) + (card-url (alist-get 'url card)) + (authors (alist-get 'authors card)) + (url (buffer-substring (car region) (cdr region))) + (url-no-query (car (split-string url "?")))) + (when (and (string= url-no-query card-url) + ;; only if we have an account's data: + (alist-get 'account (car authors))) + (goto-char (point-max)) ;;(cdr region)) + (mastodon-tl--insert-card-authors authors))))))) (buffer-string)))) +(defun mastodon-tl--insert-card-authors (authors) + "Insert a string of card AUTHORS." + (insert + (concat + "\n(Authors: " + (cl-loop for x in authors + concat + (mastodon-tl--format-card-author x)) + ")\n"))) + +(defun mastodon-tl--format-card-author (data) + "Render card author DATA." + ;; FIXME: update as needed, data contains "name" "url" and "account" + (let-alist data + (when .account + (mastodon-search--propertize-user .account)))) + (defun mastodon-tl--process-link (toot start end url) "Process link URL in TOOT as hashtag, userhandle, or normal link. START and END are the boundaries of the link in the toot." @@ -1553,7 +1582,7 @@ NO-BYLINE means just insert toot body, used for folding." (propertize ;; body only: (concat "\n" - ;; relpy symbol (broken): + ;; relpy symbol: (when (and after-reply-status-p thread) (concat (mastodon-tl--symbol 'replied) "\n")) -- cgit v1.2.3 From 64fa8d9066b3a58895e595fc3ca44249edada5df Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Fri, 11 Oct 2024 09:26:57 +0200 Subject: working v rough grouped notifs --- lisp/mastodon-notifications.el | 245 +++++++++++++++++++++++------------------ lisp/mastodon-tl.el | 28 +++-- 2 files changed, 153 insertions(+), 120 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index 46f2423..a2c0453 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -204,123 +204,150 @@ JSON is a list of alists." for x in ids collect (mastodon-notifications--alist-by-value x 'id json))) -(defun mastodon-notifications--format-note (group json type) - "Format for a NOTE of TYPE." +(defun mastodon-notifications--format-note (group status accounts) + "Format for a GROUP notification. +JSON is the full notifications JSON." ;; FIXME: apply/refactor filtering as per/with `mastodon-tl--toot' - ;; (if (member type mastodon-notifications-grouped-types) (let-alist group ;; .sample_account_ids .status_id .notifications_count ;; .most_recent_notifiation_id - (let* ((status (mastodon-notifications--alist-by-value - .status_id 'id (alist-get 'statuses json))) - (accounts (mastodon-notifications--group-accounts - .sample_account_ids (alist-get 'accounts json)))) - (insert (symbol-name type) "\n" - "accounts: " (mapconcat 'identity .sample_account_ids ", ") "\n" - (if (not (> .notifications_count (length .sample_account_ids))) - "" - (concat - "and" - (number-to-string - (- .notifications_count - (length .sample_account_ids)))) - "others \n") - ;; "count: " (number-to-string .notifications_count) - (alist-get type mastodon-notifications--action-alist) - "\n toot: " (or .status_id "") "\n" - "\n\n")) - )) - -;; non-grouped notifs: -;; (let* ((id (alist-get 'id note)) -;; (profile-note -;; (when (eq 'follow-request type) -;; (let ((str (mastodon-tl--field -;; 'note -;; (mastodon-tl--field 'account note)))) -;; (if mastodon-notifications--profile-note-in-foll-reqs-max-length -;; (string-limit str mastodon-notifications--profile-note-in-foll-reqs-max-length) -;; str)))) -;; (status (mastodon-tl--field 'status note)) -;; (follower (alist-get 'username (alist-get 'account note))) -;; (toot (alist-get 'status note)) -;; (filtered (mastodon-tl--field 'filtered toot)) -;; (filters (when filtered -;; (mastodon-tl--current-filters filtered)))) -;; (if (and filtered (assoc "hide" filters)) -;; nil -;; (mastodon-tl--insert-status -;; ;; toot -;; (cond ((or (eq type 'follow) -;; (eq type 'follow-request)) -;; ;; Using reblog with an empty id will mark this as something -;; ;; non-boostable/non-favable. -;; (cons '(reblog (id . nil)) note)) -;; ;; reblogs/faves use 'note' to process their own json -;; ;; not the toot's. this ensures following etc. work on such notifs -;; ((or (eq type 'favourite) -;; (eq type 'boost)) -;; note) -;; (t -;; status)) -;; ;; body -;; (let ((body (if-let ((match (assoc "warn" filters))) -;; (mastodon-tl--spoiler toot (cadr match)) -;; (mastodon-tl--clean-tabs-and-nl -;; (if (mastodon-tl--has-spoiler status) -;; (mastodon-tl--spoiler status) -;; (if (eq 'follow-request type) -;; (mastodon-tl--render-text profile-note) -;; (mastodon-tl--content status))))))) -;; (cond ((or (eq type 'follow) -;; (eq type 'follow-request)) -;; (if (eq type 'follow) -;; (propertize "Congratulations, you have a new follower!" -;; 'face 'default) -;; (concat -;; (propertize -;; (format "You have a follow request from... %s" -;; follower) -;; 'face 'default) -;; (when mastodon-notifications--profile-note-in-foll-reqs -;; (concat -;; ":\n" -;; (mastodon-notifications--comment-note-text body)))))) -;; ((or (eq type 'favourite) -;; (eq type 'boost)) -;; (mastodon-notifications--comment-note-text body)) -;; (t body))) -;; ;; author-byline -;; (if (or (eq type 'follow) -;; (eq type 'follow-request) -;; (eq type 'mention)) -;; 'mastodon-tl--byline-author -;; (lambda (_status &rest _args) ; unbreak stuff -;; (mastodon-tl--byline-author note))) -;; ;; action-byline -;; (lambda (_status) -;; (mastodon-notifications--byline-concat -;; (alist-get type mastodon-notifications--action-alist) -;; )) -;; id -;; ;; base toot -;; (when (or (eq type 'favourite) -;; (eq type 'boost)) -;; status)))))) + (let* ((type .type) + (type-sym (intern .type)) + (profile-note + (when (eq type-sym 'follow-request) + (let ((str (mastodon-tl--field + 'note + (car accounts)))) + (if mastodon-notifications--profile-note-in-foll-reqs-max-length + (string-limit str mastodon-notifications--profile-note-in-foll-reqs-max-length) + str)))) + (follower (car .sample_account_ids)) + (filtered (mastodon-tl--field 'filtered status)) ;;toot)) + (filters (when filtered + (mastodon-tl--current-filters filtered)))) + (if (and filtered (assoc "hide" filters)) + nil + (mastodon-tl--insert-status + ;; toot + (if (member type-sym '(follow follow_request)) + ;; Using reblog with an empty id will mark this as something + ;; non-boostable/non-favable. + (cons '(reblog (id . nil)) status) ;;note)) + ;; reblogs/faves use 'note' to process their own json not the + ;; toot's. this ensures following etc. work on such notifs + status) ;; FIXME: fix following on these notifs + ;; body + (let ((body (if-let ((match (assoc "warn" filters))) + (mastodon-tl--spoiler toot (cadr match)) + (mastodon-tl--clean-tabs-and-nl + (if (mastodon-tl--has-spoiler status) + (mastodon-tl--spoiler status) + (if (eq type 'follow-request) + (mastodon-tl--render-text profile-note) + (mastodon-tl--content status))))))) + (cond ((eq type-sym 'follow) + (propertize "Congratulations, you have a new follower!" + 'face 'default)) + ((eq type-sym 'follow-request) + (concat + (propertize + (format "You have a follow request from... %s" + follower) + 'face 'default) + (when mastodon-notifications--profile-note-in-foll-reqs + (concat + ":\n" + (mastodon-notifications--comment-note-text body))))) + ((member type-sym '(favourite boost)) + (mastodon-notifications--comment-note-text body)) + (t body))) + ;; author-byline + (lambda (&rest _args) + (mastodon-notifications--byline-account accounts status)) + ;; action-byline + (lambda (_status) + (mastodon-notifications--byline-concat + (alist-get type-sym mastodon-notifications--action-alist))) + .status_id + ;; base toot + (when (member type-sym '(favourite boost)) + status) + nil nil nil nil + nil group))))) ;; insert status still needs our group data + +;; FIXME: REFACTOR with -tl--byline: +;; we provide account directly, rather than let-alisting toot +;; almost everything is .account.field anyway +;; but toot still needed also, for attachments, etc. +(defun mastodon-notifications--byline-account + (accounts toot &optional avatar domain) + "Propertize author byline ACCOUNT for TOOT, the item responded to. +With arg AVATAR, include the account's avatar image. +When DOMAIN, force inclusion of user's domain in their handle." + (cl-loop + for account in accounts + concat + (let-alist account + (concat + ;; avatar insertion moved up to `mastodon-tl--byline' by default to + ;; be outside 'byline propt. + (when (and avatar ; used by `mastodon-profile--format-user' + mastodon-tl--show-avatars + mastodon-tl--display-media-p + (mastodon-tl--image-trans-check)) + (mastodon-media--get-avatar-rendering .avatar)) + ;; username: + (propertize (if (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 toot))) + ;; handle: + " (" + (propertize (concat "@" .acct + (when domain + (concat "@" + (url-host + (url-generic-parse-url .url))))) + 'face 'mastodon-handle-face + 'mouse-face 'highlight + 'mastodon-tab-stop 'user-handle + 'account account + 'shr-url .url + 'keymap mastodon-tl--link-keymap + 'mastodon-handle (concat "@" .acct) + 'help-echo (concat "Browse user profile of @" .acct)) + ")" + (if (< 1 (length accounts)) "\n" ""))))) (defun mastodon-notifications--by-type (groups json) "Filter NOTE for those listed in `mastodon-notifications--types-alist'. Call its function in that list on NOTE." - (cl-loop for g in groups - for type = (alist-get 'type g) - for fun = (cdr (assoc type mastodon-notifications--types-alist)) - for start-pos = (point) - do (when fun - (funcall fun g json) - (when mastodon-tl--display-media-p - ;; images-in-notifs custom is handeld in - ;; `mastodon-tl--media-attachment', not here - (mastodon-media--inline-images start-pos (point)))))) + (setq masto-grouped-notifs json) + (cl-loop + for g in groups + for start-pos = (point) + for accounts = (mastodon-notifications--group-accounts + (alist-get 'sample_account_ids g) + (alist-get 'accounts json)) + for status = (mastodon-notifications--alist-by-value + (alist-get 'status_id g) 'id + (alist-get 'statuses json)) + do (mastodon-notifications--format-note g status accounts) + (when mastodon-tl--display-media-p + ;; images-in-notifs custom is handeld in + ;; `mastodon-tl--media-attachment', not here + (mastodon-media--inline-images start-pos (point))))) (defun mastodon-notifications--timeline (json) "Format JSON in Emacs buffer." diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 2e0588f..f611c89 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -711,7 +711,8 @@ LETTER is a string, F for favourited, B for boosted, or K for bookmarked." (image-transforms-p))) (defun mastodon-tl--byline (toot author-byline action-byline - &optional detailed-p domain base-toot) + &optional detailed-p domain base-toot + group) "Generate byline for TOOT. AUTHOR-BYLINE is a function for adding the author portion of the byline that takes one variable. @@ -723,13 +724,15 @@ this just means displaying toot client. When DOMAIN, force inclusion of user's domain in their handle. BASE-TOOT is JSON for the base toot, if any." (let* ((created-time - ;; bosts and faves in notifs view - ;; (makes timestamps be for the original toot not the boost/fave): - (or (mastodon-tl--field 'created_at - (mastodon-tl--field 'status toot)) - ;; all other toots, inc. boosts/faves in timelines: - ;; (mastodon-tl--field auto fetches from reblogs if needed): - (mastodon-tl--field 'created_at toot))) + (if group + (mastodon-tl--field 'latest_page_notification_at group) + ;; bosts and faves in notifs view + ;; (makes timestamps be for the original toot not the boost/fave): + (or (mastodon-tl--field 'created_at + (mastodon-tl--field 'status toot)) + ;; all other toots, inc. boosts/faves in timelines: + ;; (mastodon-tl--field auto fetches from reblogs if needed): + (mastodon-tl--field 'created_at toot)))) (parsed-time (date-to-time created-time)) (faved (eq t (mastodon-tl--field 'favourited toot))) (boosted (eq t (mastodon-tl--field 'reblogged toot))) @@ -1519,7 +1522,7 @@ Runs `mastodon-tl--render-text' and fetches poll or media." (defun mastodon-tl--insert-status (toot body author-byline action-byline &optional id base-toot - detailed-p thread domain unfolded no-byline) + detailed-p thread domain unfolded no-byline group) "Display the content and byline of timeline element TOOT. BODY will form the section of the toot above the byline. AUTHOR-BYLINE is an optional function for adding the author @@ -1539,7 +1542,10 @@ THREAD means the status will be displayed in a thread view. When DOMAIN, force inclusion of user's domain in their handle. UNFOLDED is a boolean meaning whether to unfold or fold item if foldable. NO-BYLINE means just insert toot body, used for folding." - (let* ((reply-to-id (alist-get 'in_reply_to_id toot)) + (let* ((reply-to-id + (if group + (alist-get 'status_id group) + (alist-get 'in_reply_to_id toot))) (after-reply-status-p (when (and thread reply-to-id) (mastodon-tl--after-reply-status reply-to-id))) @@ -1572,7 +1578,7 @@ NO-BYLINE means just insert toot body, used for folding." "\n" (unless no-byline (mastodon-tl--byline toot author-byline action-byline - detailed-p domain base-toot))) + detailed-p domain base-toot group))) 'item-type 'toot 'item-id (or id ; notification's own id (alist-get 'id toot)) ; toot id -- cgit v1.2.3 From c714d1524d2f369228252d265f0a23fe1c166b14 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Fri, 11 Oct 2024 10:05:28 +0200 Subject: fix foll_reqs, add group/accounts props to notifs --- lisp/mastodon-notifications.el | 15 +++++++-------- lisp/mastodon-tl.el | 10 ++++++---- 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index a2c0453..a67ec0f 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -214,14 +214,13 @@ JSON is the full notifications JSON." (let* ((type .type) (type-sym (intern .type)) (profile-note - (when (eq type-sym 'follow-request) - (let ((str (mastodon-tl--field - 'note - (car accounts)))) + (when (eq type-sym 'follow_request) + (let ((str (mastodon-tl--field 'note (car accounts)))) (if mastodon-notifications--profile-note-in-foll-reqs-max-length (string-limit str mastodon-notifications--profile-note-in-foll-reqs-max-length) str)))) (follower (car .sample_account_ids)) + (follower-name (mastodon-tl--field 'username (car accounts))) (filtered (mastodon-tl--field 'filtered status)) ;;toot)) (filters (when filtered (mastodon-tl--current-filters filtered)))) @@ -242,17 +241,17 @@ JSON is the full notifications JSON." (mastodon-tl--clean-tabs-and-nl (if (mastodon-tl--has-spoiler status) (mastodon-tl--spoiler status) - (if (eq type 'follow-request) + (if (eq type-sym 'follow_request) (mastodon-tl--render-text profile-note) (mastodon-tl--content status))))))) (cond ((eq type-sym 'follow) (propertize "Congratulations, you have a new follower!" 'face 'default)) - ((eq type-sym 'follow-request) + ((eq type-sym 'follow_request) (concat (propertize (format "You have a follow request from... %s" - follower) + follower-name) 'face 'default) (when mastodon-notifications--profile-note-in-foll-reqs (concat @@ -273,7 +272,7 @@ JSON is the full notifications JSON." (when (member type-sym '(favourite boost)) status) nil nil nil nil - nil group))))) ;; insert status still needs our group data + nil group accounts))))) ;; insert status still needs our group data ;; FIXME: REFACTOR with -tl--byline: ;; we provide account directly, rather than let-alisting toot diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index f611c89..1b3b9ec 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1522,7 +1522,7 @@ Runs `mastodon-tl--render-text' and fetches poll or media." (defun mastodon-tl--insert-status (toot body author-byline action-byline &optional id base-toot - detailed-p thread domain unfolded no-byline group) + detailed-p thread domain unfolded no-byline group accounts) "Display the content and byline of timeline element TOOT. BODY will form the section of the toot above the byline. AUTHOR-BYLINE is an optional function for adding the author @@ -1549,7 +1549,7 @@ NO-BYLINE means just insert toot body, used for folding." (after-reply-status-p (when (and thread reply-to-id) (mastodon-tl--after-reply-status reply-to-id))) - (type (alist-get 'type toot)) + (type (alist-get 'type (or group toot))) (toot-foldable (and mastodon-tl--fold-toots-at-length (length> body mastodon-tl--fold-toots-at-length)))) @@ -1590,9 +1590,11 @@ NO-BYLINE means just insert toot body, used for folding." 'item-json toot 'base-toot base-toot 'cursor-face 'mastodon-cursor-highlight-face - 'notification-type type 'toot-foldable toot-foldable - 'toot-folded (and toot-foldable (not unfolded))) + 'toot-folded (and toot-foldable (not unfolded)) + 'notification-type type + 'notification-group group + 'notification-accounts accounts) (if no-byline "" "\n")))) (defun mastodon-tl--is-reply (toot) -- cgit v1.2.3 From 27c3165f7ffb4c52f3a8b0d65cb360ceda43aeff Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Fri, 11 Oct 2024 11:58:50 +0200 Subject: tl.el: cull :force arg for notifs reload --- lisp/mastodon-tl.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 1b3b9ec..d08baf2 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -2757,7 +2757,7 @@ Aims to respect any pagination in effect." ((eq type 'mentions) (mastodon-notifications--get-mentions)) ((eq type 'notifications) - (mastodon-notifications-get nil nil :force max-id)) + (mastodon-notifications-get nil nil max-id)) ((eq type 'profile-statuses-no-boosts) ;; TODO: max-id arg needed here also (mastodon-profile--open-statuses-no-reblogs)) -- cgit v1.2.3 From 3190c2833a1fbaeafe82585e7e6d494f8081b597 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 12 Oct 2024 12:43:06 +0200 Subject: tl.el: reorg byline author/action byline logic the base idea is to separate our logic of author byline, and action byline. previously author-byline function would indifferently handle booster if a boost, else author. now it is always an author, and we implement booster byline separately. this should pave the way for bylines at top of posts, and should be clearer and simpler also. - move booster action-byline elt from byline to insert-status (outside byline proper) - factor out byline-handle/byline-username funs - factor our byline-booster/byline-booster-str funs this breaks notifs byline logic. we will fix it subsequently. --- lisp/mastodon-tl.el | 154 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 93 insertions(+), 61 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index d08baf2..0f04e58 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -589,51 +589,68 @@ 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--byline-author (toot &optional avatar domain) +(defun mastodon-tl--byline-username (toot) + "Format a byline username from account in TOOT." + (let-alist (alist-get 'account toot) + (propertize (if (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 toot))))) + +(defun mastodon-tl--byline-handle (toot &optional domain) + "Format a byline handle from account in TOOT. +DOMAIN is optionally added to the handle." + (let-alist (alist-get 'account toot) + (propertize (concat "@" .acct + (when domain + (concat "@" + (url-host + (url-generic-parse-url .url))))) + 'face 'mastodon-handle-face + 'mouse-face 'highlight + 'mastodon-tab-stop 'user-handle + 'account .account + 'shr-url .url + 'keymap mastodon-tl--link-keymap + 'mastodon-handle (concat "@" .acct) + 'help-echo (concat "Browse user profile of @" .acct)))) + +(defun mastodon-tl--byline-author (toot &optional avatar domain base) "Propertize author of TOOT. +If TOOT contains a reblog, return author of reblogged item. With arg AVATAR, include the account's avatar image. -When DOMAIN, force inclusion of user's domain in their handle." - (let-alist toot +When DOMAIN, force inclusion of user's domain in their handle. +BASE means to use data from the base item (reblog slot) if possible. +If BASE is nil, we are a boosted byline, so show less info." + (let* ((data (if base + (mastodon-tl--toot-or-base toot) + toot))) (concat - ;; avatar insertion moved up to `mastodon-tl--byline' by default to be - ;; outside 'byline propt. + ;; avatar insertion moved up to `mastodon-tl--byline' by default to + ;; be outside 'byline propt. (when (and avatar ; used by `mastodon-profile--format-user' mastodon-tl--show-avatars mastodon-tl--display-media-p (mastodon-tl--image-trans-check)) - (mastodon-media--get-avatar-rendering .account.avatar)) - ;; username: - (propertize (if (not (string-empty-p .account.display_name)) - .account.display_name - .account.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 toot))) - ;; handle: - " (" - (propertize (concat "@" .account.acct - (when domain - (concat "@" - (url-host - (url-generic-parse-url .account.url))))) - 'face 'mastodon-handle-face - 'mouse-face 'highlight - 'mastodon-tab-stop 'user-handle - 'account .account - 'shr-url .account.url - 'keymap mastodon-tl--link-keymap - 'mastodon-handle (concat "@" .account.acct) - 'help-echo (concat "Browse user profile of @" .account.acct)) - ")"))) + (mastodon-media--get-avatar-rendering + (alist-get 'avatar + (alist-get 'account data)))) + (if (not base) + (mastodon-tl--byline-handle data domain) + (concat (mastodon-tl--byline-username data) + " (" (mastodon-tl--byline-handle data domain) ")"))))) (defun mastodon-tl--format-byline-help-echo (toot) "Format a help-echo for byline of TOOT. @@ -681,13 +698,28 @@ The result is added as an attachments property to author-byline." :type .type))) media))) -(defun mastodon-tl--byline-boosted (toot) - "Add byline for boosted data from TOOT." +(defun mastodon-tl--byline-booster (toot) + "Add author byline for booster from TOOT. +Only return something if TOOT contains a reblog." (let ((reblog (alist-get 'reblog toot))) - (when reblog - (concat - "\n " (propertize "Boosted" 'face 'mastodon-boosted-face) - " " (mastodon-tl--byline-author reblog))))) + (if reblog + (concat + " " (mastodon-tl--byline-author toot)) + ""))) + +(defun mastodon-tl--byline-booster-str (toot) + "Format boosted string for action byline. +Only return string if TOOT contains a reblog." + (let ((reblog (alist-get 'reblog toot))) + (if reblog + (concat + " " (propertize "boosted" 'face 'mastodon-boosted-face) "\n") + ""))) + +(defun mastodon-tl--byline-boost (toot) + "Format a boost action-byline element for TOOT." + (concat (mastodon-tl--byline-booster toot) + (mastodon-tl--byline-booster-str toot))) (defun mastodon-tl--format-faved-or-boosted-byline (letter) "Format the byline marker for a boosted or favourited status. @@ -710,9 +742,8 @@ LETTER is a string, F for favourited, B for boosted, or K for bookmarked." (image-type-available-p 'imagemagick) (image-transforms-p))) -(defun mastodon-tl--byline (toot author-byline action-byline - &optional detailed-p domain base-toot - group) +(defun mastodon-tl--byline (toot author-byline &optional detailed-p + domain base-toot group) "Generate byline for TOOT. AUTHOR-BYLINE is a function for adding the author portion of the byline that takes one variable. @@ -738,11 +769,11 @@ BASE-TOOT is JSON for the base toot, if any." (boosted (eq t (mastodon-tl--field 'reblogged toot))) (bookmarked (eq t (mastodon-tl--field 'bookmarked toot))) (visibility (mastodon-tl--field 'visibility toot)) - (account (alist-get 'account toot)) - (avatar-url (alist-get 'avatar account)) (type (alist-get 'type toot)) (base-toot-maybe (or base-toot ;; show edits for notifs (mastodon-tl--toot-or-base toot))) ;; for boosts + (account (alist-get 'account base-toot-maybe)) + (avatar-url (alist-get 'avatar account)) (edited-time (alist-get 'edited_at base-toot-maybe)) (edited-parsed (when edited-time (date-to-time edited-time)))) (concat @@ -762,17 +793,16 @@ BASE-TOOT is JSON for the base toot, if any." (when bookmarked (mastodon-tl--format-faved-or-boosted-byline (mastodon-tl--symbol 'bookmark)))) - ;; we remove avatars from the byline also, so that they also do not mess - ;; with `mastodon-tl--goto-next-item': + ;; we remove avatars from the byline also, so that they also do not + ;; mess with `mastodon-tl--goto-next-item': (when (and mastodon-tl--show-avatars mastodon-tl--display-media-p (mastodon-tl--image-trans-check)) (mastodon-media--get-avatar-rendering avatar-url)) (propertize (concat - ;; we propertize help-echo format faves for author name - ;; in `mastodon-tl--byline-author' - (funcall author-byline toot nil domain) + ;; NB: action-byline (boost) is now added in insert-status, so no + ;; longer part of the byline. ;; visibility: (cond ((string= visibility "direct") (propertize (concat " " (mastodon-tl--symbol 'direct)) @@ -780,8 +810,8 @@ BASE-TOOT is JSON for the base toot, if any." ((string= visibility "private") (propertize (concat " " (mastodon-tl--symbol 'private)) 'help-echo visibility))) - ;;action byline: - (funcall action-byline toot) + ;; (base) author byline: + (funcall author-byline toot nil domain :base) " " ;; timestamp: (propertize @@ -1112,7 +1142,7 @@ content should be hidden." (save-excursion (goto-char (point-min)) (while (not (string= "No more items" ; improve this hack test! - (mastodon-tl--goto-next-item :no-refresh))) + (mastodon-tl--goto-next-item :no-refresh))) (let* ((json (mastodon-tl--property 'item-json :no-move)) (cw (alist-get 'spoiler_text json))) (when (not (string= "" cw)) @@ -1576,9 +1606,11 @@ NO-BYLINE means just insert toot body, used for folding." 'toot-body t) ;; includes newlines etc. for folding ;; byline: "\n" - (unless no-byline - (mastodon-tl--byline toot author-byline action-byline - detailed-p domain base-toot group))) + (if no-byline + "" + (concat (funcall action-byline toot) + (mastodon-tl--byline toot author-byline detailed-p + domain base-toot group)))) 'item-type 'toot 'item-id (or id ; notification's own id (alist-get 'id toot)) ; toot id @@ -1665,7 +1697,7 @@ NO-BYLINE means just insert toot body, used for folding." (mastodon-tl--insert-status toot (mastodon-tl--clean-tabs-and-nl spoiler-or-content) - 'mastodon-tl--byline-author 'mastodon-tl--byline-boosted + #'mastodon-tl--byline-author #'mastodon-tl--byline-boost nil nil detailed-p thread domain unfolded no-byline)))) (defun mastodon-tl--timeline (toots &optional thread domain) -- cgit v1.2.3 From 64a0a0a276b5cadc8b4d98ee28ef1c23b4a799b7 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 12 Oct 2024 17:30:41 +0200 Subject: use byline-username/-handle in notifications--byline-accounts --- lisp/mastodon-notifications.el | 71 ++++++++++++++---------------------------- lisp/mastodon-tl.el | 10 +++--- 2 files changed, 29 insertions(+), 52 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index 73c20f1..7632173 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -278,56 +278,33 @@ JSON is the full notifications JSON." ;; we provide account directly, rather than let-alisting toot ;; almost everything is .account.field anyway ;; but toot still needed also, for attachments, etc. -(defun mastodon-notifications--byline-account - (accounts toot &optional avatar domain) +(defun mastodon-notifications--byline-accounts + (accounts toot group &optional avatar domain) "Propertize author byline ACCOUNT for TOOT, the item responded to. With arg AVATAR, include the account's avatar image. When DOMAIN, force inclusion of user's domain in their handle." - (cl-loop - for account in accounts - concat - (let-alist account - (concat - ;; avatar insertion moved up to `mastodon-tl--byline' by default to - ;; be outside 'byline propt. - (when (and avatar ; used by `mastodon-profile--format-user' - mastodon-tl--show-avatars - mastodon-tl--display-media-p - (mastodon-tl--image-trans-check)) - (mastodon-media--get-avatar-rendering .avatar)) - ;; username: - (propertize (if (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 toot))) - ;; handle: - " (" - (propertize (concat "@" .acct - (when domain - (concat "@" - (url-host - (url-generic-parse-url .url))))) - 'face 'mastodon-handle-face - 'mouse-face 'highlight - 'mastodon-tab-stop 'user-handle - 'account account - 'shr-url .url - 'keymap mastodon-tl--link-keymap - 'mastodon-handle (concat "@" .acct) - 'help-echo (concat "Browse user profile of @" .acct)) - ")" - (if (< 1 (length accounts)) "\n" ""))))) + (let ((others-count (- (alist-get 'notifications_count group) + (length accounts)))) + (concat + (cl-loop + for account in accounts + concat + (let-alist account + (concat + ;; avatar insertion moved up to `mastodon-tl--byline' by default to + ;; be outside 'byline propt. + (when (and avatar ; used by `mastodon-profile--format-user' + mastodon-tl--show-avatars + mastodon-tl--display-media-p + (mastodon-tl--image-trans-check)) + (mastodon-media--get-avatar-rendering .avatar)) + ;; username: + (mastodon-tl--byline-username toot account) + ;; handle: + " (" (mastodon-tl--byline-handle toot nil account) ")" + (if (< 1 (length accounts)) "\n" "")))) + (if (< 0 others-count) + (format "and %s others" others-count))))) (defun mastodon-notifications--by-type (groups json) "Filter NOTE for those listed in `mastodon-notifications--types-alist'. diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 0f04e58..ca5ec6f 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -589,9 +589,9 @@ 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--byline-username (toot) +(defun mastodon-tl--byline-username (toot &optional account) "Format a byline username from account in TOOT." - (let-alist (alist-get 'account toot) + (let-alist (or account (alist-get 'account toot)) (propertize (if (not (string-empty-p .display_name)) .display_name .username) @@ -609,10 +609,10 @@ Do so if type of status at poins is not follow_request/follow." (string-suffix-p "-following*" (buffer-name))) (mastodon-tl--format-byline-help-echo toot))))) -(defun mastodon-tl--byline-handle (toot &optional domain) +(defun mastodon-tl--byline-handle (toot &optional domain account) "Format a byline handle from account in TOOT. DOMAIN is optionally added to the handle." - (let-alist (alist-get 'account toot) + (let-alist (or account (alist-get 'account toot)) (propertize (concat "@" .acct (when domain (concat "@" @@ -621,7 +621,7 @@ DOMAIN is optionally added to the handle." 'face 'mastodon-handle-face 'mouse-face 'highlight 'mastodon-tab-stop 'user-handle - 'account .account + 'account account 'shr-url .url 'keymap mastodon-tl--link-keymap 'mastodon-handle (concat "@" .acct) -- cgit v1.2.3 From 56e555945b06662bad0d687c1bc53fabe4beafed Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 12 Oct 2024 18:05:29 +0200 Subject: WIP: hacking for grouped notifs to work w new byline code. --- lisp/mastodon-notifications.el | 13 ++++++++++--- lisp/mastodon-tl.el | 13 +++++++++++-- 2 files changed, 21 insertions(+), 5 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index 7632173..b758c6f 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -231,6 +231,7 @@ JSON is the full notifications JSON." (if (member type-sym '(follow follow_request)) ;; Using reblog with an empty id will mark this as something ;; non-boostable/non-favable. + ;; status (cons '(reblog (id . nil)) status) ;;note)) ;; reblogs/faves use 'note' to process their own json not the ;; toot's. this ensures following etc. work on such notifs @@ -261,10 +262,16 @@ JSON is the full notifications JSON." (mastodon-notifications--comment-note-text body)) (t body))) ;; author-byline - (lambda (&rest _args) - (mastodon-notifications--byline-account accounts status)) + (cond ((member type-sym '(favourite reblog mention)) + (lambda (&rest _args) + (mastodon-notifications--byline-accounts accounts status group))) + ((eq type-sym 'follow_request) + (lambda (&rest _args) + (mastodon-tl--byline-uname-+-handle status nil (car accounts)))) + (t #'mastodon-tl--byline-author)) + ;; #'mastodon-tl--byline-author ;; action-byline - (lambda (_status) + (lambda (&rest _args) (mastodon-notifications--byline-concat (alist-get type-sym mastodon-notifications--action-alist))) .status_id diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index ca5ec6f..cf7f9aa 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -589,6 +589,11 @@ Do so if type of status at poins is not follow_request/follow." (string= type "follow")) ; no counts for these (message "%s" echo))))) +;; FIXME: now that this can also be used for non byline rendering, let's remove +;; the toot arg, and deal with attachments higher up (on real author +;; byline only) +;; removing toot arg makes it easier to render notifs that have no status +;; (foll_reqs) (defun mastodon-tl--byline-username (toot &optional account) "Format a byline username from account in TOOT." (let-alist (or account (alist-get 'account toot)) @@ -627,6 +632,11 @@ DOMAIN is optionally added to the handle." 'mastodon-handle (concat "@" .acct) 'help-echo (concat "Browse user profile of @" .acct)))) +(defun mastodon-tl--byline-uname-+-handle (data &optional domain account) + "" + (concat (mastodon-tl--byline-username data account) + " (" (mastodon-tl--byline-handle data domain account) ")")) + (defun mastodon-tl--byline-author (toot &optional avatar domain base) "Propertize author of TOOT. If TOOT contains a reblog, return author of reblogged item. @@ -649,8 +659,7 @@ If BASE is nil, we are a boosted byline, so show less info." (alist-get 'account data)))) (if (not base) (mastodon-tl--byline-handle data domain) - (concat (mastodon-tl--byline-username data) - " (" (mastodon-tl--byline-handle data domain) ")"))))) + (mastodon-tl--byline-uname-+-handle data domain))))) (defun mastodon-tl--format-byline-help-echo (toot) "Format a help-echo for byline of TOOT. -- cgit v1.2.3 From 11fc4f01c4934e5d687382f3ccb301cb8343a6d9 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sun, 13 Oct 2024 17:01:32 +0200 Subject: re-do display of card (link) author. #596 --- lisp/mastodon-tl.el | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 3f06756..c4abbf0 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -886,6 +886,7 @@ links in the text. If TOOT is nil no parsing occurs." (car region) (cdr region) (get-text-property (car region) 'shr-url)) (when (proper-list-p toot) ;; not on profile fields cons cells + ;; render card author maybe: (let* ((card (alist-get 'card toot)) (card-url (alist-get 'url card)) (authors (alist-get 'authors card)) @@ -894,7 +895,7 @@ links in the text. If TOOT is nil no parsing occurs." (when (and (string= url-no-query card-url) ;; only if we have an account's data: (alist-get 'account (car authors))) - (goto-char (point-max)) ;;(cdr region)) + (goto-char (point-max)) (mastodon-tl--insert-card-authors authors))))))) (buffer-string)))) @@ -903,17 +904,30 @@ links in the text. If TOOT is nil no parsing occurs." (insert (concat "\n(Authors: " - (cl-loop for x in authors - concat - (mastodon-tl--format-card-author x)) + (mapconcat #'mastodon-tl--format-card-author authors "\n") ")\n"))) (defun mastodon-tl--format-card-author (data) "Render card author DATA." ;; FIXME: update as needed, data contains "name" "url" and "account" - (let-alist data - (when .account - (mastodon-search--propertize-user .account)))) + (when (alist-get 'account data) ;.account + (let-alist (alist-get 'account data) ;.account + ;; FIXME: replace with refactored handle render fun + ;; in byline refactor branch: + (concat + (propertize .username + 'face 'mastodon-display-name-face + 'byline t + 'item-type 'user + 'item-id .id) + " " + (propertize (concat "@" .acct) + 'face 'mastodon-handle-face + 'mouse-face 'highlight + 'mastodon-tab-stop 'user-handle + 'keymap mastodon-tl--link-keymap + 'mastodon-handle (concat "@" .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. -- cgit v1.2.3 From 8b4d1cbf0727879e5cbeb2f8af985cea1683c771 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 14 Oct 2024 10:04:52 +0200 Subject: no byline prop for card author --- lisp/mastodon-tl.el | 1 - 1 file changed, 1 deletion(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index c4abbf0..b32fe70 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -917,7 +917,6 @@ links in the text. If TOOT is nil no parsing occurs." (concat (propertize .username 'face 'mastodon-display-name-face - 'byline t 'item-type 'user 'item-id .id) " " -- cgit v1.2.3 From 652c17da292065d760d8ad455dba9dd26ac49ba1 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 14 Oct 2024 13:26:29 +0200 Subject: card authors tiny clean up. #596. --- lisp/mastodon-tl.el | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index b32fe70..e2cba94 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -901,17 +901,18 @@ links in the text. If TOOT is nil no parsing occurs." (defun mastodon-tl--insert-card-authors (authors) "Insert a string of card AUTHORS." - (insert - (concat - "\n(Authors: " - (mapconcat #'mastodon-tl--format-card-author authors "\n") - ")\n"))) + (let ((authors-str (format "Author%s: " + (if (< 1 (length authors)) "s" "")))) + (insert + (concat + "\n(" authors-str + (mapconcat #'mastodon-tl--format-card-author authors "\n") + ")\n")))) (defun mastodon-tl--format-card-author (data) "Render card author DATA." - ;; FIXME: update as needed, data contains "name" "url" and "account" - (when (alist-get 'account data) ;.account - (let-alist (alist-get 'account data) ;.account + (when-let ((account (alist-get 'account data))) ;.account + (let-alist account ;.account ;; FIXME: replace with refactored handle render fun ;; in byline refactor branch: (concat -- cgit v1.2.3 From 17bcc1ff7659b4eb6845a564a094bb3cae4fadd9 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 14 Oct 2024 15:32:30 +0200 Subject: byline: help echo timestamps in numbers --- lisp/mastodon-tl.el | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 2e0588f..81be479 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -781,12 +781,15 @@ BASE-TOOT is JSON for the base toot, if any." (funcall action-byline toot) " " ;; timestamp: - (propertize - (format-time-string mastodon-toot-timestamp-format parsed-time) - 'timestamp parsed-time - 'display (if mastodon-tl--enable-relative-timestamps - (mastodon-tl--relative-time-description parsed-time) - parsed-time)) + (let ((ts (format-time-string + mastodon-toot-timestamp-format parsed-time))) + (propertize ts + 'timestamp parsed-time + 'display + (if mastodon-tl--enable-relative-timestamps + (mastodon-tl--relative-time-description parsed-time) + parsed-time) + 'help-echo ts)) ;; detailed: (when detailed-p (let* ((app (alist-get 'application toot)) -- cgit v1.2.3 From c1c0d3a71d5bf81ac9e6f0169716c9903e54df06 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 14 Oct 2024 19:19:38 +0200 Subject: implement rough trending links, and link timeline --- lisp/mastodon-search.el | 38 +++++++++++++++++++++++++++++++++++++- lisp/mastodon-tl.el | 13 ++++++++++++- 2 files changed, 49 insertions(+), 2 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el index 7fc4de3..90519ed 100644 --- a/lisp/mastodon-search.el +++ b/lisp/mastodon-search.el @@ -97,6 +97,41 @@ QUERY is the string to search." (mastodon-search--view-trending "statuses" #'mastodon-tl--timeline)) +(defun mastodon-search--trending-links () + "Display a list of links trending on your instance." + (interactive) + (mastodon-search--view-trending "links" + #'mastodon-search--render-links)) + +(defun mastodon-search--render-links (links) + "Render trending LINKS." + (cl-loop for l in links + do (mastodon-search--render-link l))) + +(defun mastodon-search--render-link (link) + "Render a trending LINK." + (let-alist link + (insert + (propertize + (mastodon-tl--render-text + (concat "" .url "\n" .title) + link) + 'item-type 'link + 'item-json link + 'shr-url .url + 'byline t ;; nav + 'help-echo + (substitute-command-keys + "\\[`mastodon-search--load-link-posts'] to view a link's timeline")) + ;; TODO: display card link author here + "\n\n"))) + +(defun mastodon-search--load-link-posts () + "Load timeline of posts containing link at point." + (interactive) + (let* ((url (mastodon-tl--property 'shr-url))) + (mastodon-tl--link-timeline url))) + (defun mastodon-search--view-trending (type print-fun) "Display a list of tags trending on your instance. TYPE is a string, either tags, statuses, or links. @@ -109,7 +144,8 @@ PRINT-FUN is the function used to print the data from the response." (offset '(("offset" . "0"))) (params (push limit offset)) (data (mastodon-http--get-json url params)) - (buffer (get-buffer-create (format "*mastodon-trending-%s*" type)))) + (buffer (get-buffer-create + (format "*mastodon-trending-%s*" type)))) (with-mastodon-buffer buffer #'mastodon-mode nil (mastodon-tl--set-buffer-spec (buffer-name buffer) (format "trends/%s" type) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 81be479..75bde95 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -279,6 +279,7 @@ etc.") ;; is already bound to w also (define-key map (kbd "u") #'mastodon-tl--update) (define-key map [remap shr-browse-url] #'mastodon-url-lookup) + (define-key map (kbd "M-RET") #'mastodon-search--load-link-posts) map) "The keymap to be set for shr.el generated links that are not images. We need to override the keymap so tabbing will navigate to all @@ -575,6 +576,14 @@ With a double PREFIX arg, limit results to your own instance." (concat "timelines/tag/" (if (listp tag) (car tag) tag)) ; must be /tag/:sth 'mastodon-tl--timeline nil params))) +(defun mastodon-tl--link-timeline (url) + "Load a link timeline, displaying posts containing URL." + (let ((endpoint (mastodon-http--api "timelines/link")) + (params `(("url" . ,url)))) + (mastodon-tl--init "links" "timelines/link" + 'mastodon-tl--timeline nil + params))) + ;;; BYLINES, etc. @@ -1987,7 +1996,9 @@ call this function after it is set or use something else." ((string= "*mastodon-toot-edits*" buffer-name) 'toot-edits) ((string= "*masto-image*" (buffer-name)) - 'mastodon-image)))) + 'mastodon-image) + ((mastodon-tl--endpoint-str-= "timelines/link") + 'link-timeline)))) (defun mastodon-tl--buffer-type-eq (type) "Return t if current buffer type is equal to symbol TYPE." -- cgit v1.2.3 From 03f308c695452e1d831d50e542f4760e2c29bbb5 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 16 Oct 2024 12:48:14 +0200 Subject: rough overhaul of notifs byline code for grouped notifications --- lisp/mastodon-notifications.el | 310 +++++++++++++++++++++++++---------------- lisp/mastodon-tl.el | 17 ++- 2 files changed, 199 insertions(+), 128 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index b758c6f..aa38302 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -31,6 +31,7 @@ ;;; Code: (eval-when-compile (require 'subr-x)) +(require 'cl-lib) (autoload 'mastodon-http--api "mastodon-http") (autoload 'mastodon-http--get-params-async-json "mastodon-http") @@ -55,7 +56,12 @@ (autoload 'mastodon-tl--current-filters "mastodon-views") (autoload 'mastodon-tl--render-text "mastodon-tl") (autoload 'mastodon-notifications-get "mastodon") - +(autoload 'mastodon-tl--byline-uname-+-handle "mastodon-tl") +(autoload 'mastodon-tl--byline-username "mastodon-tl") +(autoload 'mastodon-tl--byline-handle "mastodon-tl") +(autoload 'mastodon-http--get-json "mastodon-http") +(autoload 'mastodon-media--get-avatar-rendering "mastodon-media") +(autoload 'mastodon-tl--image-trans-check "mastodon-tl") (defgroup mastodon-tl nil "Nofications in mastodon.el." @@ -81,6 +87,8 @@ make them unweildy." (defvar mastodon-tl--buffer-spec) (defvar mastodon-tl--display-media-p) (defvar mastodon-mode-map) +(defvar mastodon-tl--fold-toots-at-length) +(defvar mastodon-tl--show-avatars) (defvar mastodon-notifications--types-alist '(("follow" . mastodon-notifications--follow) @@ -95,13 +103,13 @@ make them unweildy." (defvar mastodon-notifications--response-alist '(("Followed" . "you") - ("Favourited" . "your status from") - ("Boosted" . "your status from") + ("Favourited" . "your post") + ("Boosted" . "your post") ("Mentioned" . "you") ("Posted a poll" . "that has now ended") ("Requested to follow" . "you") ("Posted" . "a post") - ("Edited" . "a post from")) + ("Edited" . "their post")) "Alist of subjects for notification types.") (defvar mastodon-notifications--map @@ -115,8 +123,9 @@ make them unweildy." (defun mastodon-notifications--byline-concat (message) "Add byline for TOOT with MESSAGE." - (concat " " (propertize message 'face 'highlight) - " " (cdr (assoc message mastodon-notifications--response-alist)))) + (concat "\n " (propertize message 'face 'highlight) + " " (cdr (assoc message mastodon-notifications--response-alist)) + "\n")) (defun mastodon-notifications--follow-request-process (&optional reject) "Process the follow request at point. @@ -206,141 +215,204 @@ JSON is a list of alists." (defun mastodon-notifications--format-note (group status accounts) "Format for a GROUP notification. -JSON is the full notifications JSON." - ;; FIXME: apply/refactor filtering as per/with `mastodon-tl--toot' - (let-alist group - ;; .sample_account_ids .status_id .notifications_count - ;; .most_recent_notifiation_id - (let* ((type .type) - (type-sym (intern .type)) - (profile-note - (when (eq type-sym 'follow_request) - (let ((str (mastodon-tl--field 'note (car accounts)))) - (if mastodon-notifications--profile-note-in-foll-reqs-max-length - (string-limit str mastodon-notifications--profile-note-in-foll-reqs-max-length) - str)))) - (follower (car .sample_account_ids)) - (follower-name (mastodon-tl--field 'username (car accounts))) - (filtered (mastodon-tl--field 'filtered status)) ;;toot)) - (filters (when filtered - (mastodon-tl--current-filters filtered)))) - (if (and filtered (assoc "hide" filters)) - nil - (mastodon-tl--insert-status - ;; toot - (if (member type-sym '(follow follow_request)) - ;; Using reblog with an empty id will mark this as something - ;; non-boostable/non-favable. - ;; status - (cons '(reblog (id . nil)) status) ;;note)) - ;; reblogs/faves use 'note' to process their own json not the - ;; toot's. this ensures following etc. work on such notifs - status) ;; FIXME: fix following on these notifs - ;; body - (let ((body (if-let ((match (assoc "warn" filters))) - (mastodon-tl--spoiler toot (cadr match)) - (mastodon-tl--clean-tabs-and-nl - (if (mastodon-tl--has-spoiler status) - (mastodon-tl--spoiler status) - (if (eq type-sym 'follow_request) - (mastodon-tl--render-text profile-note) - (mastodon-tl--content status))))))) - (cond ((eq type-sym 'follow) - (propertize "Congratulations, you have a new follower!" - 'face 'default)) - ((eq type-sym 'follow_request) - (concat - (propertize - (format "You have a follow request from... %s" - follower-name) - 'face 'default) - (when mastodon-notifications--profile-note-in-foll-reqs - (concat - ":\n" - (mastodon-notifications--comment-note-text body))))) - ((member type-sym '(favourite reblog)) - (mastodon-notifications--comment-note-text body)) - (t body))) - ;; author-byline - (cond ((member type-sym '(favourite reblog mention)) - (lambda (&rest _args) - (mastodon-notifications--byline-accounts accounts status group))) - ((eq type-sym 'follow_request) - (lambda (&rest _args) - (mastodon-tl--byline-uname-+-handle status nil (car accounts)))) - (t #'mastodon-tl--byline-author)) - ;; #'mastodon-tl--byline-author - ;; action-byline - (lambda (&rest _args) - (mastodon-notifications--byline-concat - (alist-get type-sym mastodon-notifications--action-alist))) - .status_id - ;; base toot - (when (member type-sym '(favourite reblog)) - status) - nil nil nil nil - nil group accounts))))) ;; insert status still needs our group data - -;; FIXME: REFACTOR with -tl--byline: +STATUS is the status's JSON. +ACCOUNTS is data of the accounts that have reacted to the notification." + (let ((folded nil)) + ;; FIXME: apply/refactor filtering as per/with `mastodon-tl--toot' + (let-alist group + ;; .sample_account_ids .status_id .notifications_count + ;; .most_recent_notifiation_id + (let* (;(type .type) + (type-sym (intern .type)) + (profile-note + (when (eq type-sym 'follow_request) + (let ((str (mastodon-tl--field 'note (car accounts)))) + (if mastodon-notifications--profile-note-in-foll-reqs-max-length + (string-limit str mastodon-notifications--profile-note-in-foll-reqs-max-length) + str)))) + ;; (follower (car .sample_account_ids)) + (follower-name (mastodon-tl--field 'username (car accounts))) + (filtered (mastodon-tl--field 'filtered status)) ;;toot)) + (filters (when filtered + (mastodon-tl--current-filters filtered)))) + (unless (and filtered (assoc "hide" filters)) + (if (member type-sym '(follow follow_request)) + ;; FIXME: handle follow requests, polls + (insert "TODO: follow-req\n") + (mastodon-notifications--insert-note + ;; toot + (if (member type-sym '(follow follow_request)) + ;; Using reblog with an empty id will mark this as something + ;; non-boostable/non-favable. + ;; status + status + ;; (cons '(reblog (id . nil)) status) ;;note)) + ;; reblogs/faves use 'note' to process their own json not the + ;; toot's. this ensures following etc. work on such notifs + status) ;; FIXME: fix following on these notifs + ;; body + (let ((body (if-let ((match (assoc "warn" filters))) + (mastodon-tl--spoiler status (cadr match)) + (mastodon-tl--clean-tabs-and-nl + (if (mastodon-tl--has-spoiler status) + (mastodon-tl--spoiler status) + (if (eq type-sym 'follow_request) + (mastodon-tl--render-text profile-note) + (mastodon-tl--content status))))))) + (cond ((eq type-sym 'follow) + (propertize "Congratulations, you have a new follower!" + 'face 'default)) + ((eq type-sym 'follow_request) + (concat + (propertize + (format "You have a follow request from... %s" + follower-name) + 'face 'default) + (when mastodon-notifications--profile-note-in-foll-reqs + (concat + ":\n" + (mastodon-notifications--comment-note-text body))))) + ((member type-sym '(favourite reblog)) + (mastodon-notifications--comment-note-text body)) + (t body))) + ;; author-byline + #'mastodon-tl--byline-author + ;; action-byline + (unless (member type-sym '(mention)) + (mastodon-notifications--byline-concat + (alist-get type-sym mastodon-notifications--action-alist))) + ;; action authors + (cond ((member type-sym '(mention)) + "") ;; mentions are normal statuses + ((member type-sym '(favourite reblog update)) + (mastodon-notifications--byline-accounts accounts status group)) + ((eq type-sym 'follow_request) + (mastodon-tl--byline-uname-+-handle status nil (car accounts)))) + .status_id + ;; base toot + (when (member type-sym '(favourite reblog)) + status) + folded group accounts))))))) ;; insert status still needs our group data + +;; FIXME: this is copied from `mastodon-tl--insert-status' +;; we could probably cull a lot of the code so its just for notifs +(defun mastodon-notifications--insert-note + (toot body author-byline action-byline action-authors + &optional id base-toot unfolded group accounts) + "Display the content and byline of timeline element TOOT. +BODY will form the section of the toot above the byline. +AUTHOR-BYLINE is an optional function for adding the author +portion of the byline that takes one variable. By default it is +`mastodon-tl--byline-author'. +ACTION-BYLINE is also an optional function for adding an action, +such as boosting favouriting and following to the byline. It also +takes a single function. By default it is +`mastodon-tl--byline-boosted'. +ID is that of the status if it is a notification, which is +attached as a `item-id' property if provided. If the +status is a favourite or boost notification, BASE-TOOT is the +JSON of the toot responded to. +UNFOLDED is a boolean meaning whether to unfold or fold item if foldable. +NO-BYLINE means just insert toot body, used for folding." + (let* ((type (alist-get 'type (or group toot))) + (toot-foldable + (and mastodon-tl--fold-toots-at-length + (length> body mastodon-tl--fold-toots-at-length)))) + (insert + (propertize ;; body + byline: + (concat + (concat action-authors + action-byline) + (propertize ;; body only: + body + 'toot-body t) ;; includes newlines etc. for folding + ;; byline: + "\n" + (mastodon-tl--byline toot author-byline nil nil + base-toot group)) + 'item-type 'toot + 'item-id (or id ; notification's own id + (alist-get 'id toot)) ; toot id + 'base-item-id (mastodon-tl--item-id + ;; if status is a notif, get id from base-toot + ;; (-tl--item-id toot) will not work here: + (or base-toot + toot)) ; else normal toot with reblog check + 'item-json toot + 'base-toot base-toot + 'cursor-face 'mastodon-cursor-highlight-face + 'toot-foldable toot-foldable + 'toot-folded (and toot-foldable (not unfolded)) + 'notification-type type + 'notification-group group + 'notification-accounts accounts) + "\n"))) + +;; FIXME: REFACTOR with -tl--byline?: ;; we provide account directly, rather than let-alisting toot ;; almost everything is .account.field anyway ;; but toot still needed also, for attachments, etc. (defun mastodon-notifications--byline-accounts - (accounts toot group &optional avatar domain) - "Propertize author byline ACCOUNT for TOOT, the item responded to. + (accounts toot group &optional avatar compact) + "Propertize author byline ACCOUNTS for TOOT, the item responded to. With arg AVATAR, include the account's avatar image. When DOMAIN, force inclusion of user's domain in their handle." - (let ((others-count (- (alist-get 'notifications_count group) - (length accounts)))) + (let ((total (alist-get 'notifications_count group)) + (accts 2)) (concat (cl-loop for account in accounts + repeat accts concat (let-alist account (concat - ;; avatar insertion moved up to `mastodon-tl--byline' by default to - ;; be outside 'byline propt. + ;; avatar insertion moved up to `mastodon-tl--byline' by + ;; default to be outside 'byline propt. (when (and avatar ; used by `mastodon-profile--format-user' mastodon-tl--show-avatars mastodon-tl--display-media-p (mastodon-tl--image-trans-check)) (mastodon-media--get-avatar-rendering .avatar)) - ;; username: - (mastodon-tl--byline-username toot account) - ;; handle: - " (" (mastodon-tl--byline-handle toot nil account) ")" - (if (< 1 (length accounts)) "\n" "")))) - (if (< 0 others-count) - (format "and %s others" others-count))))) - -(defun mastodon-notifications--by-type (groups json) - "Filter NOTE for those listed in `mastodon-notifications--types-alist'. -Call its function in that list on NOTE." - (setq masto-grouped-notifs json) - (cl-loop - for g in groups - for start-pos = (point) - for accounts = (mastodon-notifications--group-accounts - (alist-get 'sample_account_ids g) - (alist-get 'accounts json)) - for status = (mastodon-notifications--alist-by-value - (alist-get 'status_id g) 'id - (alist-get 'statuses json)) - do (mastodon-notifications--format-note g status accounts) - (when mastodon-tl--display-media-p - ;; images-in-notifs custom is handeld in - ;; `mastodon-tl--media-attachment', not here - (mastodon-media--inline-images start-pos (point))))) + (let ((uname (mastodon-tl--byline-username toot account)) + (handle (concat + "(" + (mastodon-tl--byline-handle toot nil account) + ")"))) + (if compact + ;; FIXME: this doesn't work to make a link from a username: + (propertize handle 'display uname) + (concat uname handle))) + "\n"))) ;; FIXME: only if not last handle + (if (< accts total) + (let ((diff (- total accts))) + ;; FIXME: help echo all remaining accounts? + (format "\nand %s other%s" diff (if (= 1 diff) "" "s"))))))) + +(defun mastodon-notifications--render (json) + "Display grouped notifications in JSON." + ;; (setq masto-grouped-notifs json) + (let ((groups (alist-get 'notification_groups json))) + (cl-loop + for g in groups + for start-pos = (point) + for accounts = (mastodon-notifications--group-accounts + (alist-get 'sample_account_ids g) + (alist-get 'accounts json)) + for status = (mastodon-notifications--alist-by-value + (alist-get 'status_id g) 'id + (alist-get 'statuses json)) + do (mastodon-notifications--format-note g status accounts) + (when mastodon-tl--display-media-p + ;; images-in-notifs custom is handeld in + ;; `mastodon-tl--media-attachment', not here + (mastodon-media--inline-images start-pos (point)))))) (defun mastodon-notifications--timeline (json) "Format JSON in Emacs buffer." (if (seq-empty-p json) (user-error "Looks like you have no (more) notifications for now") - (let ((groups (alist-get 'notification_groups json))) - ;; (mapc (lambda (x) - (mastodon-notifications--by-type groups json) - ;; grouped) - (goto-char (point-min))))) + (mastodon-notifications--render json) + (goto-char (point-min)))) (defun mastodon-notifications--get-mentions () "Display mention notifications in buffer." diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 3ebfa4e..efc16ac 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -598,11 +598,10 @@ Do so if type of status at poins is not follow_request/follow." (string= type "follow")) ; no counts for these (message "%s" echo))))) -;; FIXME: now that this can also be used for non byline rendering, let's remove -;; the toot arg, and deal with attachments higher up (on real author -;; byline only) -;; removing toot arg makes it easier to render notifs that have no status -;; (foll_reqs) +;; FIXME: now that this can also be used for non byline rendering, let's +;; remove the toot arg, and deal with attachments higher up (on real +;; author byline only) removing toot arg makes it easier to render notifs +;; that have no status (foll_reqs) (defun mastodon-tl--byline-username (toot &optional account) "Format a byline username from account in TOOT." (let-alist (or account (alist-get 'account toot)) @@ -634,12 +633,12 @@ DOMAIN is optionally added to the handle." (url-generic-parse-url .url))))) 'face 'mastodon-handle-face 'mouse-face 'highlight - 'mastodon-tab-stop 'user-handle + 'mastodon-tab-stop 'user-handle 'account account - 'shr-url .url - 'keymap mastodon-tl--link-keymap + 'shr-url .url + '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--byline-uname-+-handle (data &optional domain account) "" -- cgit v1.2.3 From f114f3c19066e5bd7211389e6730b23a17c35e09 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 16 Oct 2024 13:39:30 +0200 Subject: notifs: fix foll_reqs --- lisp/mastodon-notifications.el | 154 ++++++++++++++++++++++------------------- lisp/mastodon-tl.el | 19 ++--- 2 files changed, 92 insertions(+), 81 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index c969c8e..599b4aa 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -232,77 +232,80 @@ ACCOUNTS is data of the accounts that have reacted to the notification." (let-alist group ;; .sample_account_ids .status_id .notifications_count ;; .most_recent_notifiation_id - (let* (;(type .type) - (type-sym (intern .type)) + (let* ((type-sym (intern .type)) (profile-note - (when (eq type-sym 'follow_request) + (when (member type-sym '(follow follow_request)) (let ((str (mastodon-tl--field 'note (car accounts)))) (if mastodon-notifications--profile-note-in-foll-reqs-max-length (string-limit str mastodon-notifications--profile-note-in-foll-reqs-max-length) str)))) - ;; (follower (car .sample_account_ids)) - (follower-name (mastodon-tl--field 'username (car accounts))) - (filtered (mastodon-tl--field 'filtered status)) ;;toot)) + (follower (when (member type-sym + '(reblog favourite follow follow_request)) + (car accounts))) + (follower-name (mastodon-tl--field 'username follower)) + (filtered (mastodon-tl--field 'filtered status)) (filters (when filtered (mastodon-tl--current-filters filtered)))) (unless (and filtered (assoc "hide" filters)) - (if (member type-sym '(follow follow_request)) - ;; FIXME: handle follow requests, polls - (insert "TODO: follow-req\n") - (mastodon-notifications--insert-note - ;; toot - (if (member type-sym '(follow follow_request)) - ;; Using reblog with an empty id will mark this as something - ;; non-boostable/non-favable. - ;; status - status - ;; (cons '(reblog (id . nil)) status) ;;note)) - ;; reblogs/faves use 'note' to process their own json not the - ;; toot's. this ensures following etc. work on such notifs - status) ;; FIXME: fix following on these notifs - ;; body - (let ((body (if-let ((match (assoc "warn" filters))) - (mastodon-tl--spoiler status (cadr match)) - (mastodon-tl--clean-tabs-and-nl - (if (mastodon-tl--has-spoiler status) - (mastodon-tl--spoiler status) - (if (eq type-sym 'follow_request) - (mastodon-tl--render-text profile-note) - (mastodon-tl--content status))))))) - (cond ((eq type-sym 'follow) - (propertize "Congratulations, you have a new follower!" - 'face 'default)) - ((eq type-sym 'follow_request) - (concat - (propertize - (format "You have a follow request from... %s" - follower-name) - 'face 'default) - (when mastodon-notifications--profile-note-in-foll-reqs - (concat - ":\n" - (mastodon-notifications--comment-note-text body))))) - ((member type-sym '(favourite reblog)) - (mastodon-notifications--comment-note-text body)) - (t body))) - ;; author-byline - #'mastodon-tl--byline-author - ;; action-byline - (unless (member type-sym '(mention)) - (mastodon-notifications--byline-concat - (alist-get type-sym mastodon-notifications--action-alist))) - ;; action authors - (cond ((member type-sym '(mention)) - "") ;; mentions are normal statuses - ((member type-sym '(favourite reblog update)) - (mastodon-notifications--byline-accounts accounts status group)) + (mastodon-notifications--insert-note + ;; toot + ;; FIXME: fix following on grouped notifs + ;; FIXME: block boost/fave on boost/fave notifs? + (if (member type-sym + ;; reblogs/faves use 'note' to process their own + ;; json not the toot's. this ensures following etc. + ;; work on such notifs + '(reblog favourite follow follow_request)) + ;; FIXME: breaks item stats! + follower + ;; Using reblog with an empty id will mark this as something + ;; non-boostable/non-favable. + ;; (cons '(reblog (id . nil)) status) ;;note)) + status) + ;; body + (let ((body (if-let ((match (assoc "warn" filters))) + (mastodon-tl--spoiler status (cadr match)) + (mastodon-tl--clean-tabs-and-nl + (if (mastodon-tl--has-spoiler status) + (mastodon-tl--spoiler status) + (if (eq type-sym 'follow_request) + (mastodon-tl--render-text profile-note) + (mastodon-tl--content status))))))) + (cond ((eq type-sym 'follow) + (propertize "Congratulations, you have a new follower!" + 'face 'default)) ((eq type-sym 'follow_request) - (mastodon-tl--byline-uname-+-handle status nil (car accounts)))) - .status_id - ;; base toot - (when (member type-sym '(favourite reblog)) - status) - folded group accounts))))))) ;; insert status still needs our group data + (concat + (propertize + (format "You have a follow request from... %s" + follower-name) + 'face 'default) + (when mastodon-notifications--profile-note-in-foll-reqs + (concat + ":\n" + (mastodon-notifications--comment-note-text body))))) + ((member type-sym '(favourite reblog)) + (mastodon-notifications--comment-note-text body)) + (t body))) + ;; author-byline + #'mastodon-tl--byline-author + ;; action-byline + (unless (member type-sym '(follow follow_request mention)) + (mastodon-notifications--byline-concat + (alist-get type-sym mastodon-notifications--action-alist))) + ;; action authors + (cond + ((member type-sym '(follow_request mention)) + "") ;; mentions are normal statuses + ((member type-sym '(favourite reblog update)) + (mastodon-notifications--byline-accounts accounts status group)) + ((eq type-sym 'follow_request) + (mastodon-tl--byline-uname-+-handle status nil (car accounts)))) + .status_id + ;; base toot + (when (member type-sym '(favourite reblog)) + status) + folded group accounts)))))) ;; FIXME: this is copied from `mastodon-tl--insert-status' ;; we could probably cull a lot of the code so its just for notifs @@ -314,16 +317,19 @@ BODY will form the section of the toot above the byline. AUTHOR-BYLINE is an optional function for adding the author portion of the byline that takes one variable. By default it is `mastodon-tl--byline-author'. -ACTION-BYLINE is also an optional function for adding an action, -such as boosting favouriting and following to the byline. It also -takes a single function. By default it is -`mastodon-tl--byline-boosted'. +ACTION-BYLINE is a string, obtained by calling +`mastodon-notifications--byline-concat'. +ACTION-AUTHORS is a string of those who have responded to the +current item, obtained by calling +`mastodon-notifications--byline-accounts' ID is that of the status if it is a notification, which is attached as a `item-id' property if provided. If the status is a favourite or boost notification, BASE-TOOT is the JSON of the toot responded to. -UNFOLDED is a boolean meaning whether to unfold or fold item if foldable. -NO-BYLINE means just insert toot body, used for folding." +UNFOLDED is a boolean meaning whether to unfold or fold item if +foldable. +GROUP is the notification group data. +ACCOUNTS is the notification accounts data." (let* ((type (alist-get 'type (or group toot))) (toot-foldable (and mastodon-tl--fold-toots-at-length @@ -339,7 +345,9 @@ NO-BYLINE means just insert toot body, used for folding." ;; byline: "\n" (mastodon-tl--byline toot author-byline nil nil - base-toot group)) + base-toot group + (if (member type '("follow" "follow_request")) + toot))) ;; account data! 'item-type 'toot 'item-id (or id ; notification's own id (alist-get 'id toot)) ; toot id @@ -365,8 +373,10 @@ NO-BYLINE means just insert toot body, used for folding." (defun mastodon-notifications--byline-accounts (accounts toot group &optional avatar compact) "Propertize author byline ACCOUNTS for TOOT, the item responded to. -With arg AVATAR, include the account's avatar image. -When DOMAIN, force inclusion of user's domain in their handle." +GROUP is the group notification data. +When AVATAR, include the account's avatar image. +When DOMAIN, force inclusion of user's domain in their handle. +When COMPACT, just display username, not also handle." (let ((total (alist-get 'notifications_count group)) (accts 2)) (concat @@ -385,7 +395,7 @@ When DOMAIN, force inclusion of user's domain in their handle." (mastodon-media--get-avatar-rendering .avatar)) (let ((uname (mastodon-tl--byline-username toot account)) (handle (concat - "(" + " (" (mastodon-tl--byline-handle toot nil account) ")"))) (if compact diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index efc16ac..f6460e1 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -645,7 +645,7 @@ DOMAIN is optionally added to the handle." (concat (mastodon-tl--byline-username data account) " (" (mastodon-tl--byline-handle data domain account) ")")) -(defun mastodon-tl--byline-author (toot &optional avatar domain base) +(defun mastodon-tl--byline-author (toot &optional avatar domain base account) "Propertize author of TOOT. If TOOT contains a reblog, return author of reblogged item. With arg AVATAR, include the account's avatar image. @@ -666,8 +666,8 @@ If BASE is nil, we are a boosted byline, so show less info." (alist-get 'avatar (alist-get 'account data)))) (if (not base) - (mastodon-tl--byline-handle data domain) - (mastodon-tl--byline-uname-+-handle data domain))))) + (mastodon-tl--byline-handle data domain account) + (mastodon-tl--byline-uname-+-handle data domain account))))) (defun mastodon-tl--format-byline-help-echo (toot) "Format a help-echo for byline of TOOT. @@ -760,7 +760,7 @@ LETTER is a string, F for favourited, B for boosted, or K for bookmarked." (image-transforms-p))) (defun mastodon-tl--byline (toot author-byline &optional detailed-p - domain base-toot group) + domain base-toot group account) "Generate byline for TOOT. AUTHOR-BYLINE is a function for adding the author portion of the byline that takes one variable. @@ -789,7 +789,8 @@ BASE-TOOT is JSON for the base toot, if any." (type (alist-get 'type toot)) (base-toot-maybe (or base-toot ;; show edits for notifs (mastodon-tl--toot-or-base toot))) ;; for boosts - (account (alist-get 'account base-toot-maybe)) + (account (or account + (alist-get 'account base-toot-maybe))) (avatar-url (alist-get 'avatar account)) (edited-time (alist-get 'edited_at base-toot-maybe)) (edited-parsed (when edited-time (date-to-time edited-time)))) @@ -828,7 +829,7 @@ BASE-TOOT is JSON for the base toot, if any." (propertize (concat " " (mastodon-tl--symbol 'private)) 'help-echo visibility))) ;; (base) author byline: - (funcall author-byline toot nil domain :base) + (funcall author-byline toot nil domain :base account) " " ;; timestamp: (let ((ts (format-time-string @@ -852,10 +853,10 @@ BASE-TOOT is JSON for the base toot, 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 -- cgit v1.2.3 From 934024173c05678610ac26ba86730e93f9475ea7 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 16 Oct 2024 13:58:49 +0200 Subject: notifs: byline funcall dostrings --- lisp/mastodon-tl.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index f6460e1..6c90b58 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -766,7 +766,7 @@ AUTHOR-BYLINE is a function for adding the author portion of the byline that takes one variable. ACTION-BYLINE is a function for adding an action, such as boosting, favouriting and following to the byline. It also takes a single function. -By default it is `mastodon-tl--byline-boosted'. +By default it is `mastodon-tl--byline-author' DETAILED-P means display more detailed info. For now this just means displaying toot client. When DOMAIN, force inclusion of user's domain in their handle. @@ -1625,7 +1625,7 @@ portion of the byline that takes one variable. By default it is ACTION-BYLINE is also an optional function for adding an action, such as boosting favouriting and following to the byline. It also takes a single function. By default it is -`mastodon-tl--byline-boosted'. +`mastodon-tl--byline-boost'. ID is that of the status if it is a notification, which is attached as a `item-id' property if provided. If the status is a favourite or boost notification, BASE-TOOT is the -- cgit v1.2.3 From 4b58d618e7f21a4e716f4f491f0bb6348a129a61 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 16 Oct 2024 14:03:11 +0200 Subject: bylines: move attachments from byline author to --byline --- lisp/mastodon-tl.el | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 6c90b58..3dd4736 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -610,7 +610,7 @@ Do so if type of status at poins is not follow_request/follow." .username) 'face 'mastodon-display-name-face ;; enable playing of videos when point is on byline: - 'attachments (mastodon-tl--get-attachments-for-byline toot) + ;; '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. @@ -633,12 +633,12 @@ DOMAIN is optionally added to the handle." (url-generic-parse-url .url))))) 'face 'mastodon-handle-face 'mouse-face 'highlight - 'mastodon-tab-stop 'user-handle + 'mastodon-tab-stop 'user-handle 'account account - 'shr-url .url - 'keymap mastodon-tl--link-keymap + 'shr-url .url + '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--byline-uname-+-handle (data &optional domain account) "" @@ -853,10 +853,10 @@ BASE-TOOT is JSON for the base toot, 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 @@ -881,6 +881,8 @@ BASE-TOOT is JSON for the base toot, if any." 'favourited-p faved 'boosted-p boosted 'bookmarked-p bookmarked + ;; enable playing of videos when point is on byline: + 'attachments (mastodon-tl--get-attachments-for-byline toot) 'edited edited-time 'edit-history (when edited-time (mastodon-toot--get-toot-edits -- cgit v1.2.3 From 5a0ab77d0faad9a32361907c2b610d458844ffad Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 16 Oct 2024 18:26:21 +0200 Subject: bylines: format boost authors as clickable handles but display uname --- lisp/mastodon-tl.el | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 3dd4736..fa48414 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -626,12 +626,13 @@ Do so if type of status at poins is not follow_request/follow." "Format a byline handle from account in TOOT. DOMAIN is optionally added to the handle." (let-alist (or account (alist-get 'account toot)) - (propertize (concat "@" .acct - (when domain - (concat "@" - (url-host - (url-generic-parse-url .url))))) - 'face 'mastodon-handle-face + (propertize (or string + (concat "@" .acct + (when domain + (concat "@" + (url-host + (url-generic-parse-url .url)))))) + 'face (or face 'mastodon-handle-face) 'mouse-face 'highlight 'mastodon-tab-stop 'user-handle 'account account @@ -654,7 +655,11 @@ BASE means to use data from the base item (reblog slot) if possible. If BASE is nil, we are a boosted byline, so show less info." (let* ((data (if base (mastodon-tl--toot-or-base toot) - toot))) + toot)) + (account (or account (alist-get 'account data))) + (uname (if (not (string-empty-p (alist-get 'display_name account))) + (alist-get 'display_name account) + (alist-get 'username account)))) (concat ;; avatar insertion moved up to `mastodon-tl--byline' by default to ;; be outside 'byline propt. @@ -666,7 +671,10 @@ If BASE is nil, we are a boosted byline, so show less info." (alist-get 'avatar (alist-get 'account data)))) (if (not base) - (mastodon-tl--byline-handle data domain account) + (mastodon-tl--byline-handle + data domain account + ;; display uname not handle (for boosts): + uname 'mastodon-display-name-face) (mastodon-tl--byline-uname-+-handle data domain account))))) (defun mastodon-tl--format-byline-help-echo (toot) -- cgit v1.2.3 From bf01cb7caae67dae36382e0489bc53d56c2172d7 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 16 Oct 2024 18:27:12 +0200 Subject: bylines: fix visibility icon position --- lisp/mastodon-tl.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index fa48414..42ed5c5 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -829,6 +829,8 @@ BASE-TOOT is JSON for the base toot, if any." (concat ;; NB: action-byline (boost) is now added in insert-status, so no ;; longer part of the byline. + ;; (base) author byline: + (funcall author-byline toot nil domain :base account) ;; visibility: (cond ((string= visibility "direct") (propertize (concat " " (mastodon-tl--symbol 'direct)) @@ -836,8 +838,6 @@ BASE-TOOT is JSON for the base toot, if any." ((string= visibility "private") (propertize (concat " " (mastodon-tl--symbol 'private)) 'help-echo visibility))) - ;; (base) author byline: - (funcall author-byline toot nil domain :base account) " " ;; timestamp: (let ((ts (format-time-string -- cgit v1.2.3 From d74004b02d412bd3fff6ec37393c4e21873296a7 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 16 Oct 2024 18:27:43 +0200 Subject: flycheck -tl.el --- lisp/mastodon-tl.el | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 42ed5c5..74c79c3 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -92,6 +92,7 @@ (autoload 'mastodon-toot--with-toot-item "mastodon-toot") (autoload 'mastodon-media--image-or-cached "mastodon-media") (autoload 'mastodon-toot--base-toot-or-item-json "mastodon-toot") +(autoload 'mastodon-search--load-link-posts "mastodon-search") (defvar mastodon-toot--visibility) (defvar mastodon-toot-mode) @@ -578,8 +579,7 @@ With a double PREFIX arg, limit results to your own instance." (defun mastodon-tl--link-timeline (url) "Load a link timeline, displaying posts containing URL." - (let ((endpoint (mastodon-http--api "timelines/link")) - (params `(("url" . ,url)))) + (let ((params `(("url" . ,url)))) (mastodon-tl--init "links" "timelines/link" 'mastodon-tl--timeline nil params))) @@ -603,7 +603,8 @@ Do so if type of status at poins is not follow_request/follow." ;; author byline only) removing toot arg makes it easier to render notifs ;; that have no status (foll_reqs) (defun mastodon-tl--byline-username (toot &optional account) - "Format a byline username from account in TOOT." + "Format a byline username from account in TOOT. +ACCOUNT is optionally acccount data to use." (let-alist (or account (alist-get 'account toot)) (propertize (if (not (string-empty-p .display_name)) .display_name @@ -622,9 +623,14 @@ Do so if type of status at poins is not follow_request/follow." (string-suffix-p "-following*" (buffer-name))) (mastodon-tl--format-byline-help-echo toot))))) -(defun mastodon-tl--byline-handle (toot &optional domain account) +(defun mastodon-tl--byline-handle (toot &optional domain account string face) "Format a byline handle from account in TOOT. -DOMAIN is optionally added to the handle." +DOMAIN is optionally added to the handle. +ACCOUNT is optionally acccount data to use. +STRING is optionally the string to propertize. +FACE is optionally the face to use. +The last two args allow for display a username as a clickable +handle." (let-alist (or account (alist-get 'account toot)) (propertize (or string (concat "@" .acct @@ -642,7 +648,10 @@ DOMAIN is optionally added to the handle." 'help-echo (concat "Browse user profile of @" .acct)))) (defun mastodon-tl--byline-uname-+-handle (data &optional domain account) - "" + "Concatenate a byline username and handle. +DATA is the (toot) data to use. +DOMAIN is optionally a domain for the handle. +ACCOUNT is optionally acccount data to use." (concat (mastodon-tl--byline-username data account) " (" (mastodon-tl--byline-handle data domain account) ")")) @@ -652,7 +661,8 @@ If TOOT contains a reblog, return author of reblogged item. With arg AVATAR, include the account's avatar image. When DOMAIN, force inclusion of user's domain in their handle. BASE means to use data from the base item (reblog slot) if possible. -If BASE is nil, we are a boosted byline, so show less info." +If BASE is nil, we are a boosted byline, so show less info. +ACCOUNT is optionally acccount data to use." (let* ((data (if base (mastodon-tl--toot-or-base toot) toot)) -- cgit v1.2.3 From 3e7f1eccd386c3c041a482b9250ed0ef5f768354 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 17 Oct 2024 13:09:19 +0200 Subject: notifs: top byline: action symbol, action author, action str --- lisp/mastodon-notifications.el | 48 +++++++++++++++++++++++------------------- lisp/mastodon-tl.el | 2 ++ 2 files changed, 28 insertions(+), 22 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index 8517a84..eef68a2 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -124,16 +124,8 @@ make them unweildy." (defun mastodon-notifications--byline-concat (message) "Add byline for TOOT with MESSAGE." - (concat "\n " - (mastodon-tl--symbol - (cond ((string= message "Favourited") - 'favourite) - ((string= message "Boosted") - 'boost) - ((string= message "Edited") - 'edited))) - " " - (propertize message 'face 'highlight) + (concat " " + (propertize message 'face 'mastodon-boosted-face) " " (cdr (assoc message mastodon-notifications--response-alist)) "\n")) @@ -281,22 +273,31 @@ ACCOUNTS is data of the accounts that have reacted to the notification." ":\n" (mastodon-notifications--comment-note-text body))))) ((member type-sym '(favourite reblog)) - (mastodon-notifications--comment-note-text body)) + (propertize + (mastodon-notifications--comment-note-text body) + ;; indent faves/boosts (maybe remove): + 'line-prefix " " + 'wrap-prefix " ")) (t body))) ;; author-byline #'mastodon-tl--byline-author ;; action-byline (unless (member type-sym '(follow follow_request mention)) - (mastodon-notifications--byline-concat - (alist-get type-sym mastodon-notifications--action-alist))) + (downcase + (mastodon-notifications--byline-concat + (alist-get type-sym mastodon-notifications--action-alist)))) ;; action authors (cond ((member type-sym '(follow_request mention)) "") ;; mentions are normal statuses ((member type-sym '(favourite reblog update)) - (mastodon-notifications--byline-accounts accounts status group)) + (mastodon-notifications--byline-accounts + accounts status group)) ((eq type-sym 'follow_request) (mastodon-tl--byline-uname-+-handle status nil (car accounts)))) + ;; action symbol: + (when (member type-sym '(favourite reblog update)) + (mastodon-tl--symbol type-sym)) .status_id ;; base toot (when (member type-sym '(favourite reblog)) @@ -306,7 +307,7 @@ ACCOUNTS is data of the accounts that have reacted to the notification." ;; FIXME: this is copied from `mastodon-tl--insert-status' ;; we could probably cull a lot of the code so its just for notifs (defun mastodon-notifications--insert-note - (toot body author-byline action-byline action-authors + (toot body author-byline action-byline action-authors action-symbol &optional id base-toot unfolded group accounts) "Display the content and byline of timeline element TOOT. BODY will form the section of the toot above the byline. @@ -331,15 +332,17 @@ ACCOUNTS is the notification accounts data." (and mastodon-tl--fold-toots-at-length (length> body mastodon-tl--fold-toots-at-length)))) (insert - (propertize ;; body + byline: + (propertize ;; top byline, body + byline: (concat - (concat action-authors - action-byline) - (propertize ;; body only: + (propertize ;; top byline + (concat action-symbol " " action-authors + action-byline) + 'byline-top t) + (propertize ;; body only body 'toot-body t) ;; includes newlines etc. for folding - ;; byline: "\n" + ;; actual byline: (mastodon-tl--byline toot author-byline nil nil base-toot group (if (member type '("follow" "follow_request")) @@ -396,11 +399,12 @@ When COMPACT, just display username, not also handle." (alist-get 'username account)))) (mastodon-tl--byline-handle toot nil account uname 'mastodon-display-name-face)) - "\n")))) + ", "))) + nil ", ") (if (< accts total) (let ((diff (- total accts))) ;; FIXME: help echo all remaining accounts? - (format "\nand %s other%s" diff (if (= 1 diff) "" "s"))))))) + (format " and %s other%s" diff (if (= 1 diff) "" "s"))))))) (defun mastodon-notifications--render (json) "Display grouped notifications in JSON." diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 74c79c3..c5ada75 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -155,6 +155,7 @@ nil." (defcustom mastodon-tl--symbols '((reply . ("💬" . "R")) (boost . ("🔁" . "B")) + (reblog . ("🔁" . "B")) ;; server compat (favourite . ("⭐" . "F")) (bookmark . ("🔖" . "K")) (media . ("📹" . "[media]")) @@ -163,6 +164,7 @@ nil." (private . ("🔒" . "[followers]")) (direct . ("✉" . "[direct]")) (edited . ("✍" . "[edited]")) + (update . ("✍" . "[edited]")) ;; server compat (replied . ("⬇" . "↓")) (reply-bar . ("┃" . "|"))) "A set of symbols (and fallback strings) to be used in timeline. -- cgit v1.2.3 From 95875366372b6acf571254cc70f58caa80dda19b Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 17 Oct 2024 14:12:01 +0200 Subject: notifs: no stats for foll-reqs / tl--byline: get type from group --- lisp/mastodon-tl.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index c5ada75..7d41971 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -806,7 +806,9 @@ BASE-TOOT is JSON for the base toot, if any." (boosted (eq t (mastodon-tl--field 'reblogged toot))) (bookmarked (eq t (mastodon-tl--field 'bookmarked toot))) (visibility (mastodon-tl--field 'visibility toot)) - (type (alist-get 'type toot)) + (type (if group + (alist-get 'type group) + (alist-get 'type toot))) (base-toot-maybe (or base-toot ;; show edits for notifs (mastodon-tl--toot-or-base toot))) ;; for boosts (account (or account -- cgit v1.2.3 From 3338be8e330c9e904c3bd6d1e603506346a88557 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 17 Oct 2024 14:30:19 +0200 Subject: notifs: tl--more-json-async: v2 api for notifs --- lisp/mastodon-tl.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 7d41971..6005a54 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -2824,7 +2824,8 @@ the current view." (args (append args params)) (url (mastodon-http--api endpoint - (when (string-suffix-p "search" endpoint) + (when (or (string= endpoint "notifications") + (string-suffix-p "search" endpoint)) "v2")))) (apply #'mastodon-http--get-json-async url args callback cbargs))) -- cgit v1.2.3 From c784cb81ab693d0979425b1cd223df106f9802fc Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 17 Oct 2024 19:28:08 +0200 Subject: notifs: fix pagination using grouped min/max ids --- lisp/mastodon-notifications.el | 12 ++++++------ lisp/mastodon-tl.el | 20 ++++++++++++++++---- 2 files changed, 22 insertions(+), 10 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index c2d1962..debc760 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -355,11 +355,8 @@ ACCOUNTS is the notification accounts data." (if (member type '("follow" "follow_request")) toot))) ;; account data! 'item-type 'toot ;; for nav, actions, etc. - 'item-id (or - ;; grouped notifications pagination max_id: - ;; NB: their min id used for our max id param - (alist-get 'page_min_id group) - (alist-get 'id toot)) ; toot id + 'item-id (or (alist-get 'page_max_id group) ;; newest notif + (alist-get 'id toot)) ; toot id 'base-item-id (mastodon-tl--item-id ;; if status is a notif, get id from base-toot ;; (-tl--item-id toot) will not work here: @@ -373,7 +370,10 @@ ACCOUNTS is the notification accounts data." ;; grouped notifs data: 'notification-type type 'notification-group group - 'notification-accounts accounts) + 'notification-accounts accounts + ;; for pagination: + 'notifications-min-id (alist-get 'page_min_id group) + 'notifications-max-id (alist-get 'page_max_id group)) "\n"))) ;; FIXME: REFACTOR with -tl--byline?: diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 6005a54..99663ac 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -2216,16 +2216,28 @@ BACKWARD means move backward (up) the timeline." (get-text-property (point) prop))))) (defun mastodon-tl--newest-id () - "Return item-id from the top of the buffer." + "Return item-id from the top of the buffer. +If we are in a notifications view, return `notifications-max-id'." (save-excursion (goto-char (point-min)) - (mastodon-tl--property 'item-id))) + (mastodon-tl--property + (if (eq (mastodon-tl--get-buffer-type) + (member (mastodon-tl--get-buffer-type) + '(mentions notifications))) + 'notifications-max-id + 'item-id)))) (defun mastodon-tl--oldest-id () - "Return item-id from the bottom of the buffer." + "Return item-id from the bottom of the buffer. +If we are in a notifications view, return `notifications-min-id'." (save-excursion (goto-char (point-max)) - (mastodon-tl--property 'item-id nil :backward))) + (mastodon-tl--property + (if (member (mastodon-tl--get-buffer-type) + '(mentions notifications)) + 'notifications-min-id + 'item-id) + nil :backward))) (defun mastodon-tl--as-string (numeric) "Convert NUMERIC to string." -- cgit v1.2.3 From 22b81fabbe7272163d88b5234e948c76963f4de3 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 17 Oct 2024 19:28:31 +0200 Subject: tiny clean up of tl--update --- lisp/mastodon-tl.el | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 99663ac..28fbb64 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -3184,12 +3184,13 @@ This location is defined by a non-nil value of (interactive) ;; FIXME: actually these buffers should just reload by calling their own ;; load function (actually g is mostly mapped as such): - (if (or (mastodon-tl--buffer-type-eq 'trending-statuses) - (mastodon-tl--buffer-type-eq 'trending-tags) - (mastodon-tl--buffer-type-eq 'follow-suggestions) - (mastodon-tl--buffer-type-eq 'lists) - (mastodon-tl--buffer-type-eq 'filters) - (mastodon-tl--buffer-type-eq 'scheduled-statuses) + (if (or (member (mastodon-tl--get-buffer-type) + '(trending-statuses + trending-tags + follow-suggestions + lists + filters + scheduled-statuses)) (mastodon-tl--search-buffer-p)) (user-error "Update not available in this view") ;; FIXME: handle update for search and trending buffers @@ -3197,7 +3198,7 @@ This location is defined by a non-nil value of (update-function (mastodon-tl--update-function))) ;; update a thread, without calling `mastodon-tl--updated-json': (if (mastodon-tl--buffer-type-eq 'thread) - ;; load whole thread whole thread + ;; load whole thread: (let ((thread-id (mastodon-tl--thread-parent-id))) (funcall update-function thread-id) (message "Loaded full thread.")) @@ -3211,8 +3212,9 @@ This location is defined by a non-nil value of (mastodon-tl--set-after-update-marker) (goto-char (or mastodon-tl--update-point (point-min))) (funcall update-function json) - (when mastodon-tl--after-update-marker - (goto-char mastodon-tl--after-update-marker))))))))) + (if mastodon-tl--after-update-marker + (goto-char mastodon-tl--after-update-marker) + (mastodon-tl--goto-next-item))))))))) ;;; LOADING TIMELINES -- cgit v1.2.3 From 61e85a022c573193afa97d11798ed0553f2364d4 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 17 Oct 2024 20:45:06 +0200 Subject: add some more symbols, for notifs actions --- lisp/mastodon-notifications.el | 2 +- lisp/mastodon-tl.el | 32 ++++++++++++++++++-------------- 2 files changed, 19 insertions(+), 15 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index 9ec3252..339857c 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -292,7 +292,7 @@ ACCOUNTS is data of the accounts that have reacted to the notification." (t (mastodon-notifications--byline-accounts accounts status group))) ;; action symbol: - (when (member type-sym '(favourite reblog update)) + (unless (eq type-sym 'mention) (mastodon-tl--symbol type-sym)) .status_id ;; base toot (no need for update/poll/?) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 28fbb64..f4051a3 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -153,20 +153,24 @@ nil." :type 'boolean) (defcustom mastodon-tl--symbols - '((reply . ("💬" . "R")) - (boost . ("🔁" . "B")) - (reblog . ("🔁" . "B")) ;; server compat - (favourite . ("⭐" . "F")) - (bookmark . ("🔖" . "K")) - (media . ("📹" . "[media]")) - (verified . ("" . "V")) - (locked . ("🔒" . "[locked]")) - (private . ("🔒" . "[followers]")) - (direct . ("✉" . "[direct]")) - (edited . ("✍" . "[edited]")) - (update . ("✍" . "[edited]")) ;; server compat - (replied . ("⬇" . "↓")) - (reply-bar . ("┃" . "|"))) + '((reply . ("💬" . "R")) + (boost . ("🔁" . "B")) + (reblog . ("🔁" . "B")) ;; server compat + (favourite . ("⭐" . "F")) + (bookmark . ("🔖" . "K")) + (media . ("📹" . "[media]")) + (verified . ("" . "V")) + (locked . ("🔒" . "[locked]")) + (private . ("🔒" . "[followers]")) + (direct . ("✉" . "[direct]")) + (edited . ("✍" . "[edited]")) + (update . ("✍" . "[edited]")) ;; server compat + (status . ("✍" . "[posted]")) + (replied . ("⬇" . "↓")) + (reply-bar . ("┃" . "|")) + (poll . ("📊" . "")) + (follow . ("👤" . "+")) + (follow_request . ("👤" . "+"))) "A set of symbols (and fallback strings) to be used in timeline. If a symbol does not look right (tofu), it means your font settings do not support it." -- cgit v1.2.3 From 91058026d2d98b62072f372211b899a0c31433df Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 17 Oct 2024 22:07:04 +0200 Subject: notifs: handle actions fixed via user-handles-get --- lisp/mastodon-tl.el | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index f4051a3..b0658e2 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -2551,23 +2551,29 @@ LANGS is the accumulated array param alist if we re-run recursively." (get-text-property (point) 'profile-json)) (list (alist-get 'acct (mastodon-profile--profile-json)))) + ;; (grouped) notifications: + ((member (mastodon-tl--get-buffer-type) '(mentions notifications)) + (append ;; those acting on item: + (cl-remove-duplicates + (cl-loop for a in (mastodon-tl--property 'notification-accounts :no-move) + collect (alist-get 'acct a))) + ;; mentions in item: + (mastodon-profile--extract-users-handles + (mastodon-profile--item-json)))) (t (mastodon-profile--extract-users-handles (mastodon-profile--item-json)))))) - ;; return immediately if only 1 handle: - (if (eq 1 (length user-handles)) - (car user-handles) - (completing-read (cond ((or ; TODO: make this "enable/disable notifications" - (string= action "disable") - (string= action "enable")) - (format "%s notifications when user posts: " action)) - ((string-suffix-p "boosts" action) - (format "%s by user: " action)) - (t - (format "Handle of user to %s: " action))) - user-handles - nil ; predicate - 'confirm))))) + (completing-read (cond ((or ; TODO: make this "enable/disable notifications" + (string= action "disable") + (string= action "enable")) + (format "%s notifications when user posts: " action)) + ((string-suffix-p "boosts" action) + (format "%s by user: " action)) + (t + (format "Handle of user to %s: " action))) + user-handles + nil ; predicate + 'confirm)))) (defun mastodon-tl--get-blocks-or-mutes-list (action) "Fetch the list of accounts for ACTION from the server. -- cgit v1.2.3 From cb9be01c7e57a38b58ab79ecce1f80b868701e20 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Fri, 18 Oct 2024 08:22:36 +0200 Subject: notifs: fix do-user-action and get-user-handles for grouped notifs notifs: user action and response: if nothing in notifs data, fallback --- lisp/mastodon-tl.el | 110 +++++++++++++++++++++++++++++----------------------- 1 file changed, 61 insertions(+), 49 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index b0658e2..cdfdf5f 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -2535,45 +2535,44 @@ LANGS is the accumulated array param alist if we re-run recursively." "Get the list of user-handles for ACTION from the current toot." (mastodon-tl--do-if-item (let ((user-handles - (cond ((or ; follow suggests / search / foll requests compat: - (mastodon-tl--buffer-type-eq 'follow-suggestions) - (mastodon-tl--buffer-type-eq 'search) - (mastodon-tl--buffer-type-eq 'follow-requests) - ;; profile follows/followers but not statuses: - (mastodon-tl--buffer-type-eq 'profile-followers) - (mastodon-tl--buffer-type-eq 'profile-following)) - ;; fetch 'item-json: - (list (alist-get 'acct - (mastodon-tl--property 'item-json :no-move)))) - ;; profile view, point in profile details, poss no toots - ;; needed for e.g. gup.pe groups which show no toots publically: - ((and (mastodon-tl--profile-buffer-p) - (get-text-property (point) 'profile-json)) - (list (alist-get 'acct - (mastodon-profile--profile-json)))) - ;; (grouped) notifications: - ((member (mastodon-tl--get-buffer-type) '(mentions notifications)) - (append ;; those acting on item: - (cl-remove-duplicates - (cl-loop for a in (mastodon-tl--property 'notification-accounts :no-move) - collect (alist-get 'acct a))) - ;; mentions in item: - (mastodon-profile--extract-users-handles - (mastodon-profile--item-json)))) - (t - (mastodon-profile--extract-users-handles - (mastodon-profile--item-json)))))) - (completing-read (cond ((or ; TODO: make this "enable/disable notifications" - (string= action "disable") - (string= action "enable")) - (format "%s notifications when user posts: " action)) - ((string-suffix-p "boosts" action) - (format "%s by user: " action)) - (t - (format "Handle of user to %s: " action))) - user-handles - nil ; predicate - 'confirm)))) + (cond + ((or ; follow suggests / search / foll requests compat: + (member (mastodon-tl--get-buffer-type) + '( follow-suggestions search follow-requests + ;; profile follows/followers but not statuses: + profile-followers profile-following))) + ;; fetch 'item-json: + (list (alist-get 'acct + (mastodon-tl--property 'item-json :no-move)))) + ;; profile view, point in profile details, poss no toots + ;; needed for e.g. gup.pe groups which show no toots publically: + ((and (mastodon-tl--profile-buffer-p) + (get-text-property (point) 'profile-json)) + (list (alist-get 'acct + (mastodon-profile--profile-json)))) + ;; (grouped) notifications: + ((member (mastodon-tl--get-buffer-type) '(mentions notifications)) + (append ;; those acting on item: + (cl-remove-duplicates + (cl-loop for a in (mastodon-tl--property + 'notification-accounts :no-move) + collect (alist-get 'acct a))) + ;; mentions in item: + (mastodon-profile--extract-users-handles + (mastodon-profile--item-json)))) + (t + (mastodon-profile--extract-users-handles + (mastodon-profile--item-json)))))) + (completing-read + (cond ((or ; TODO: make this "enable/disable notifications" + (string= action "disable") + (string= action "enable")) + (format "%s notifications when user posts: " action)) + ((string-suffix-p "boosts" action) + (format "%s by user: " action)) + (t (format "Handle of user to %s: " action))) + user-handles nil ; predicate + 'confirm)))) (defun mastodon-tl--get-blocks-or-mutes-list (action) "Fetch the list of accounts for ACTION from the server. @@ -2599,16 +2598,29 @@ NOTIFY is only non-nil when called by `mastodon-tl--follow-user'. LANGS is an array parameters alist of languages to filer user's posts by. REBLOGS is a boolean string like NOTIFY, enabling or disabling display of the user's boosts in your timeline." - (let* ((account (if negp - ;; unmuting/unblocking, handle from mute/block list - (mastodon-profile--search-account-by-handle user-handle) - (mastodon-profile--lookup-account-in-status - user-handle - (if (mastodon-tl--profile-buffer-p) - ;; profile view, use 'profile-json as status: - (mastodon-profile--profile-json) - ;; muting/blocking, select from handles in current status - (mastodon-profile--item-json))))) + (let* ((account + (cond + (negp ;; unmuting/unblocking, use mute/block list + (mastodon-profile--search-account-by-handle user-handle)) + ;; (grouped) notifications: + ((member (mastodon-tl--get-buffer-type) + '(mentions notifications)) + (let ((accounts (mastodon-tl--property 'notification-accounts))) + (or (cl-some (lambda (x) + (when (string= user-handle (alist-get 'acct x)) + x)) + accounts) + (mastodon-profile--lookup-account-in-status + user-handle + (mastodon-profile--item-json))))) + (t + (mastodon-profile--lookup-account-in-status + user-handle + (if (mastodon-tl--profile-buffer-p) + ;; profile view, use 'profile-json as status: + (mastodon-profile--profile-json) + ;; muting/blocking, select from handles in current status + (mastodon-profile--item-json)))))) (user-id (alist-get 'id account)) (name (if (string-empty-p (alist-get 'display_name account)) (alist-get 'username account) -- cgit v1.2.3 From f4fb3251d3dcec60f088e6a822319ba8b4556921 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Fri, 18 Oct 2024 08:23:34 +0200 Subject: do use action response: change cond clause not/or to make a neither --- lisp/mastodon-tl.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index cdfdf5f..77eb320 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -2674,8 +2674,7 @@ ARGS is an alist of any parameters to send with the request." ((assoc "languages[]" args #'string=) (message "User %s filtered by language(s): %s" name (mapconcat #'cdr args " "))) - ((and (eq notify nil) - (eq reblogs nil)) + ((not (or notify reblogs)) (if (and (string= action "follow") (eq t (alist-get 'requested json))) (message "Follow requested for user %s (@%s)!" name user-handle) -- cgit v1.2.3 From 390c1d0c2dec6f247830cd507d8d1e8ca4db3479 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Fri, 18 Oct 2024 09:13:07 +0200 Subject: bump version, copyright --- lisp/mastodon-discover.el | 2 +- lisp/mastodon-http.el | 2 +- lisp/mastodon-inspect.el | 2 +- lisp/mastodon-media.el | 2 +- lisp/mastodon-notifications.el | 2 +- lisp/mastodon-profile.el | 2 +- lisp/mastodon-tl.el | 2 +- lisp/mastodon-toot.el | 2 +- lisp/mastodon-views.el | 2 +- lisp/mastodon.el | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-discover.el b/lisp/mastodon-discover.el index c34d85f..9278432 100644 --- a/lisp/mastodon-discover.el +++ b/lisp/mastodon-discover.el @@ -1,7 +1,7 @@ ;;; mastodon-discover.el --- Use Mastodon.el with discover.el -*- lexical-binding: t -*- ;; Copyright (C) 2019 Johnson Denen -;; Copyright (C) 2020-2022 Marty Hiatt +;; Copyright (C) 2020-2024 Marty Hiatt ;; Author: Johnson Denen ;; Marty Hiatt ;; Maintainer: Marty Hiatt diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el index c0402f0..42b599d 100644 --- a/lisp/mastodon-http.el +++ b/lisp/mastodon-http.el @@ -1,7 +1,7 @@ ;;; mastodon-http.el --- HTTP request/response functions for mastodon.el -*- lexical-binding: t -*- ;; Copyright (C) 2017-2019 Johnson Denen -;; Copyright (C) 2020-2022 Marty Hiatt +;; Copyright (C) 2020-2024 Marty Hiatt ;; Author: Johnson Denen ;; Marty Hiatt ;; Maintainer: Marty Hiatt diff --git a/lisp/mastodon-inspect.el b/lisp/mastodon-inspect.el index 43c8ba4..adc6d64 100644 --- a/lisp/mastodon-inspect.el +++ b/lisp/mastodon-inspect.el @@ -1,7 +1,7 @@ ;;; mastodon-inspect.el --- Client for Mastodon -*- lexical-binding: t -*- ;; Copyright (C) 2017-2019 Johnson Denen -;; Copyright (C) 2020-2022 Marty Hiatt +;; Copyright (C) 2020-2024 Marty Hiatt ;; Author: Johnson Denen ;; Marty Hiatt ;; Maintainer: Marty Hiatt diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index 2ec498e..fff5d23 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -1,7 +1,7 @@ ;;; mastodon-media.el --- Functions for inlining Mastodon media -*- lexical-binding: t -*- ;; Copyright (C) 2017-2019 Johnson Denen -;; Copyright (C) 2020-2022 Marty Hiatt +;; Copyright (C) 2020-2024 Marty Hiatt ;; Author: Johnson Denen ;; Marty Hiatt ;; Maintainer: Marty Hiatt diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index b54b012..c2257b2 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -1,7 +1,7 @@ ;;; mastodon-notifications.el --- Notification functions for mastodon.el -*- lexical-binding: t -*- ;; Copyright (C) 2017-2019 Johnson Denen -;; Copyright (C) 2020-2022 Marty Hiatt +;; Copyright (C) 2020-2024 Marty Hiatt ;; Author: Johnson Denen ;; Marty Hiatt ;; Maintainer: Marty Hiatt diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 900e9c0..8db1d69 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -1,7 +1,7 @@ ;;; mastodon-profile.el --- Functions for inspecting Mastodon profiles -*- lexical-binding: t -*- ;; Copyright (C) 2017-2019 Johnson Denen -;; Copyright (C) 2020-2022 Marty Hiatt +;; Copyright (C) 2020-2024 Marty Hiatt ;; Author: Johnson Denen ;; Marty Hiatt ;; Maintainer: Marty Hiatt diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 77eb320..92bf0a6 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1,7 +1,7 @@ ;;; mastodon-tl.el --- Timeline functions for mastodon.el -*- lexical-binding: t -*- ;; Copyright (C) 2017-2019 Johnson Denen -;; Copyright (C) 2020-2022 Marty Hiatt +;; Copyright (C) 2020-2024 Marty Hiatt ;; Author: Johnson Denen ;; Marty Hiatt ;; Maintainer: Marty Hiatt diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 386b720..b5322b3 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -1,7 +1,7 @@ ;;; mastodon-toot.el --- Minor mode for sending Mastodon toots -*- lexical-binding: t -*- ;; Copyright (C) 2017-2019 Johnson Denen -;; Copyright (C) 2020-2022 Marty Hiatt +;; Copyright (C) 2020-2024 Marty Hiatt ;; Author: Johnson Denen ;; Marty Hiatt ;; Maintainer: Marty Hiatt diff --git a/lisp/mastodon-views.el b/lisp/mastodon-views.el index ac62b1f..3112c20 100644 --- a/lisp/mastodon-views.el +++ b/lisp/mastodon-views.el @@ -1,6 +1,6 @@ ;;; mastodon-views.el --- Minor views functions for mastodon.el -*- lexical-binding: t -*- -;; Copyright (C) 2020-2022 Marty Hiatt +;; Copyright (C) 2020-2024 Marty Hiatt ;; Author: Marty Hiatt ;; Maintainer: Marty Hiatt ;; Homepage: https://codeberg.org/martianh/mastodon.el diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 80b6d8c..e754b28 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -6,7 +6,7 @@ ;; Author: Johnson Denen ;; Marty Hiatt ;; Maintainer: Marty Hiatt -;; Version: 1.0.27 +;; Version: 1.1.0 ;; Package-Requires: ((emacs "27.1") (request "0.3.0") ;; (persist "0.4") (tp "0.1")) ;; Homepage: https://codeberg.org/martianh/mastodon.el -- cgit v1.2.3 From 854b7027bc390807876595d2a014e9e61abad591 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Fri, 18 Oct 2024 11:38:35 +0200 Subject: images in threads: load images for single-toot and thread toot --- lisp/mastodon-tl.el | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 92bf0a6..b0f5981 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -2281,6 +2281,9 @@ ID is that of the toot to view." #'mastodon-tl--update-toot) (mastodon-tl--toot toot :detailed-p) (goto-char (point-min)) + (when mastodon-tl--display-media-p + (mastodon-media--inline-images (point-min) + (point-max))) (mastodon-tl--goto-next-item :no-refresh))))) (defun mastodon-tl--update-toot (json) @@ -2339,6 +2342,11 @@ view all branches of a thread." (move-marker marker (point)) ;; print re-fetched toot: (mastodon-tl--toot toot :detailed-p :thread) + ;; inline images only for the toot + ;; (`mastodon-tl--timeline' handles the rest): + (when mastodon-tl--display-media-p + (mastodon-media--inline-images marker ;start-pos + (point))) (mastodon-tl--timeline (alist-get 'descendants context) :thread) ;; put point at the toot: -- cgit v1.2.3 From ce4c59c4328b7050bd9e0844980ce9c8f91a7f82 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Fri, 18 Oct 2024 15:32:53 +0200 Subject: add boost symbol in boost author byline --- lisp/mastodon-tl.el | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index b0f5981..50d623a 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -687,10 +687,15 @@ ACCOUNT is optionally acccount data to use." (alist-get 'avatar (alist-get 'account data)))) (if (not base) - (mastodon-tl--byline-handle - data domain account - ;; display uname not handle (for boosts): - uname 'mastodon-display-name-face) + ;; boost symbol: + (concat (mastodon-tl--symbol 'boost) + " " + ;; username as button: + (mastodon-tl--byline-handle + data domain account + ;; display uname not handle (for boosts): + uname 'mastodon-display-name-face)) + ;; normal combo author byline: (mastodon-tl--byline-uname-+-handle data domain account))))) (defun mastodon-tl--format-byline-help-echo (toot) -- cgit v1.2.3 From 6975a22a1c3b403b5aa86bb7a375220b6b0f9fea Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 19 Oct 2024 12:10:04 +0200 Subject: bylines: try out booster byline as top byline (like notifs) --- lisp/mastodon-tl.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 50d623a..7d333e4 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1686,6 +1686,7 @@ NO-BYLINE means just insert toot body, used for folding." (propertize ;; body only: (concat "\n" + (funcall action-byline toot) ;; relpy symbol: (when (and after-reply-status-p thread) (concat (mastodon-tl--symbol 'replied) @@ -1705,9 +1706,8 @@ NO-BYLINE means just insert toot body, used for folding." "\n" (if no-byline "" - (concat (funcall action-byline toot) - (mastodon-tl--byline toot author-byline detailed-p - domain base-toot group)))) + (mastodon-tl--byline toot author-byline detailed-p + domain base-toot group))) 'item-type 'toot 'item-id (or id ; notification's own id (alist-get 'id toot)) ; toot id -- cgit v1.2.3 From 595ad8b8620a63b7ef5a7569bc6cb44675904051 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 19 Oct 2024 12:30:22 +0200 Subject: remove stray " " from byline-booster --- lisp/mastodon-tl.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 7d333e4..95632cd 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -749,8 +749,7 @@ The result is added as an attachments property to author-byline." Only return something if TOOT contains a reblog." (let ((reblog (alist-get 'reblog toot))) (if reblog - (concat - " " (mastodon-tl--byline-author toot)) + (mastodon-tl--byline-author toot) ""))) (defun mastodon-tl--byline-booster-str (toot) -- cgit v1.2.3 From cfe4703513dc574a58baf1fd7883082563bdbcc5 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 19 Oct 2024 21:55:39 +0200 Subject: notifs: remove stale notifs code from tl--insert-status --- lisp/mastodon-notifications.el | 1 - lisp/mastodon-tl.el | 24 +++++++++--------------- 2 files changed, 9 insertions(+), 16 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index f163863..cb36616 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -46,7 +46,6 @@ (autoload 'mastodon-tl--find-property-range "mastodon-tl") (autoload 'mastodon-tl--has-spoiler "mastodon-tl") (autoload 'mastodon-tl--init "mastodon-tl") -(autoload 'mastodon-tl--insert-status "mastodon-tl") (autoload 'mastodon-tl--property "mastodon-tl") (autoload 'mastodon-tl--reload-timeline-or-profile "mastodon-tl") (autoload 'mastodon-tl--spoiler "mastodon-tl") diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 95632cd..5d0fafc 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -798,7 +798,9 @@ By default it is `mastodon-tl--byline-author' DETAILED-P means display more detailed info. For now this just means displaying toot client. When DOMAIN, force inclusion of user's domain in their handle. -BASE-TOOT is JSON for the base toot, if any." +BASE-TOOT is JSON for the base toot, if any. +GROUP is the notification group if any. +ACCOUNT is the notification account if any." (let* ((created-time (if group (mastodon-tl--field 'latest_page_notification_at group) @@ -814,9 +816,7 @@ BASE-TOOT is JSON for the base toot, if any." (boosted (eq t (mastodon-tl--field 'reblogged toot))) (bookmarked (eq t (mastodon-tl--field 'bookmarked toot))) (visibility (mastodon-tl--field 'visibility toot)) - (type (if group - (alist-get 'type group) - (alist-get 'type toot))) + (type (alist-get 'type (or group toot))) (base-toot-maybe (or base-toot ;; show edits for notifs (mastodon-tl--toot-or-base toot))) ;; for boosts (account (or account @@ -1648,7 +1648,7 @@ Runs `mastodon-tl--render-text' and fetches poll or media." (defun mastodon-tl--insert-status (toot body author-byline action-byline &optional id base-toot - detailed-p thread domain unfolded no-byline group accounts) + detailed-p thread domain unfolded no-byline) "Display the content and byline of timeline element TOOT. BODY will form the section of the toot above the byline. AUTHOR-BYLINE is an optional function for adding the author @@ -1668,14 +1668,11 @@ THREAD means the status will be displayed in a thread view. When DOMAIN, force inclusion of user's domain in their handle. UNFOLDED is a boolean meaning whether to unfold or fold item if foldable. NO-BYLINE means just insert toot body, used for folding." - (let* ((reply-to-id - (if group - (alist-get 'status_id group) - (alist-get 'in_reply_to_id toot))) + (let* ((reply-to-id (alist-get 'in_reply_to_id toot)) (after-reply-status-p (when (and thread reply-to-id) (mastodon-tl--after-reply-status reply-to-id))) - (type (alist-get 'type (or group toot))) + ;; (type (alist-get 'type toot)) (toot-foldable (and mastodon-tl--fold-toots-at-length (length> body mastodon-tl--fold-toots-at-length)))) @@ -1706,7 +1703,7 @@ NO-BYLINE means just insert toot body, used for folding." (if no-byline "" (mastodon-tl--byline toot author-byline detailed-p - domain base-toot group))) + domain base-toot))) 'item-type 'toot 'item-id (or id ; notification's own id (alist-get 'id toot)) ; toot id @@ -1719,10 +1716,7 @@ NO-BYLINE means just insert toot body, used for folding." 'base-toot base-toot 'cursor-face 'mastodon-cursor-highlight-face 'toot-foldable toot-foldable - 'toot-folded (and toot-foldable (not unfolded)) - 'notification-type type - 'notification-group group - 'notification-accounts accounts) + 'toot-folded (and toot-foldable (not unfolded))) (if no-byline "" "\n")))) (defun mastodon-tl--is-reply (toot) -- cgit v1.2.3 From bfb2b4b2276622830b7a5ed1066c64ef6d5693e8 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sun, 20 Oct 2024 10:11:40 +0200 Subject: refactor display-or-uname --- lisp/mastodon-notifications.el | 5 +---- lisp/mastodon-search.el | 4 +--- lisp/mastodon-tl.el | 34 ++++++++++++++++------------------ 3 files changed, 18 insertions(+), 25 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index cb36616..0177ba7 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -376,10 +376,7 @@ When DOMAIN, force inclusion of user's domain in their handle." mastodon-tl--display-media-p (mastodon-tl--image-trans-check)) (mastodon-media--get-avatar-rendering .avatar)) - (let ((uname - (if (not (string-empty-p (alist-get 'display_name account))) - (alist-get 'display_name account) - (alist-get 'username account)))) + (let ((uname (mastodon-tl--display-or-uname account))) (mastodon-tl--byline-handle toot nil account uname 'mastodon-display-name-face)) ", "))) diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el index 262f75c..cead17e 100644 --- a/lisp/mastodon-search.el +++ b/lisp/mastodon-search.el @@ -331,9 +331,7 @@ If NOTE is non-nil, include user's profile note. This is also (defun mastodon-search--get-user-info (account) "Get user handle, display name, account URL and profile note from ACCOUNT." - (list (if (not (string-empty-p (alist-get 'display_name account))) - (alist-get 'display_name account) - (alist-get 'username account)) + (list (mastodon-tl--display-or-uname account) (alist-get 'acct account) (alist-get 'url account) (alist-get 'note account))) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 5d0fafc..437a5e3 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -661,6 +661,12 @@ ACCOUNT is optionally acccount data to use." (concat (mastodon-tl--byline-username data account) " (" (mastodon-tl--byline-handle data domain account) ")")) +(defun mastodon-tl--display-or-uname (account) + "Return display name or username from ACCOUNT data." + (if (not (string-empty-p (alist-get 'display_name account))) + (alist-get 'display_name account) + (alist-get 'username account))) + (defun mastodon-tl--byline-author (toot &optional avatar domain base account) "Propertize author of TOOT. If TOOT contains a reblog, return author of reblogged item. @@ -673,9 +679,7 @@ ACCOUNT is optionally acccount data to use." (mastodon-tl--toot-or-base toot) toot)) (account (or account (alist-get 'account data))) - (uname (if (not (string-empty-p (alist-get 'display_name account))) - (alist-get 'display_name account) - (alist-get 'username account)))) + (uname (mastodon-tl--display-or-uname account))) (concat ;; avatar insertion moved up to `mastodon-tl--byline' by default to ;; be outside 'byline propt. @@ -684,8 +688,7 @@ ACCOUNT is optionally acccount data to use." mastodon-tl--display-media-p (mastodon-tl--image-trans-check)) (mastodon-media--get-avatar-rendering - (alist-get 'avatar - (alist-get 'account data)))) + (map-nested-elt data '(account avatar)))) (if (not base) ;; boost symbol: (concat (mastodon-tl--symbol 'boost) @@ -873,10 +876,9 @@ ACCOUNT is the notification account if any." 'help-echo ts)) ;; detailed: (when detailed-p - (let* ((app (alist-get 'application toot)) - (app-name (alist-get 'name app)) - (app-url (alist-get 'website app))) - (when app + (let* ((app-name (map-nested-elt toot '(application name))) + (app-url (map-nested-elt toot '(application website)))) + (when app-name (concat (propertize " via " 'face 'default) (propertize app-name @@ -973,9 +975,8 @@ links in the text. If TOOT is nil no parsing occurs." (get-text-property (car region) 'shr-url)) (when (proper-list-p toot) ;; not on profile fields cons cells ;; render card author maybe: - (let* ((card (alist-get 'card toot)) - (card-url (alist-get 'url card)) - (authors (alist-get 'authors card)) + (let* ((card-url (map-nested-elt toot '(card url))) + (authors (map-nested-elt toot '(card authors))) (url (buffer-substring (car region) (cdr region))) (url-no-query (car (split-string url "?")))) (when (and (string= url-no-query card-url) @@ -1121,7 +1122,7 @@ the toot)." (url-generic-parse-url instance-url))) (parsed (url-generic-parse-url url)) (path (url-filename parsed)) - (split (string-split path "/"))) + (split (split-string path "/"))) (when (and (string= instance-host (url-host parsed)) (string-prefix-p "/tag" path)) ;; "/tag/" or "/tags/" (nth 2 split)))) @@ -2395,8 +2396,7 @@ If UNMUTE, unmute it." (defun mastodon-tl--map-account-id-from-toot (statuses) "Return a list of the account IDs of the author of each toot in STATUSES." (mapcar (lambda (status) - (alist-get 'id - (alist-get 'account status))) + (map-nested-elt status '(account id))) statuses)) (defun mastodon-tl--user-in-thread-p (id) @@ -2628,9 +2628,7 @@ display of the user's boosts in your timeline." ;; muting/blocking, select from handles in current status (mastodon-profile--item-json)))))) (user-id (alist-get 'id account)) - (name (if (string-empty-p (alist-get 'display_name account)) - (alist-get 'username account) - (alist-get 'display_name account))) + (name (mastodon-tl--display-or-uname account)) (args (cond (notify `(("notify" . ,notify))) (langs langs) (reblogs `(("reblogs" . ,reblogs))) -- cgit v1.2.3 From ef6762986de6f4c85405dbc01ae19854cd2687fd Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sun, 20 Oct 2024 13:39:06 +0200 Subject: change email address --- README.org | 2 +- lisp/mastodon-async.el | 2 +- lisp/mastodon-auth.el | 2 +- lisp/mastodon-client.el | 2 +- lisp/mastodon-discover.el | 4 ++-- lisp/mastodon-http.el | 4 ++-- lisp/mastodon-inspect.el | 4 ++-- lisp/mastodon-iso.el | 2 +- lisp/mastodon-media.el | 4 ++-- lisp/mastodon-notifications.el | 4 ++-- lisp/mastodon-profile.el | 4 ++-- lisp/mastodon-search.el | 4 ++-- lisp/mastodon-tl.el | 4 ++-- lisp/mastodon-toot.el | 4 ++-- lisp/mastodon-transient.el | 2 +- lisp/mastodon-views.el | 4 ++-- lisp/mastodon.el | 4 ++-- mastodon.texi | 2 +- 18 files changed, 29 insertions(+), 29 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/README.org b/README.org index cf6aed5..1898366 100644 --- a/README.org +++ b/README.org @@ -487,7 +487,7 @@ If you prefer emailing patches to the process described below, feel free to send If you'd like to support continued development of =mastodon.el=, I accept donations via paypal: [[https://paypal.me/martianh][paypal.me/martianh]]. If you would prefer a different -payment method, please write to me at and I can +payment method, please write to me at and I can provide IBAN or other bank account details. I don't have a tech worker's income, so even a small tip would help out. diff --git a/lisp/mastodon-async.el b/lisp/mastodon-async.el index 317be93..b059407 100644 --- a/lisp/mastodon-async.el +++ b/lisp/mastodon-async.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2017 Alex J. Griffith ;; Author: Alex J. Griffith -;; Maintainer: Marty Hiatt +;; Maintainer: Marty Hiatt ;; Package-Requires: ((emacs "27.1")) ;; Homepage: https://codeberg.org/martianh/mastodon.el diff --git a/lisp/mastodon-auth.el b/lisp/mastodon-auth.el index 3796b7e..01639fb 100644 --- a/lisp/mastodon-auth.el +++ b/lisp/mastodon-auth.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2017-2019 Johnson Denen ;; Copyright (C) 2021 Abhiseck Paira ;; Author: Johnson Denen -;; Maintainer: Marty Hiatt +;; Maintainer: Marty Hiatt ;; Homepage: https://codeberg.org/martianh/mastodon.el ;; This file is not part of GNU Emacs. diff --git a/lisp/mastodon-client.el b/lisp/mastodon-client.el index 6e55829..c0db3d6 100644 --- a/lisp/mastodon-client.el +++ b/lisp/mastodon-client.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2017-2019 Johnson Denen ;; Copyright (C) 2021 Abhiseck Paira ;; Author: Johnson Denen -;; Maintainer: Marty Hiatt +;; Maintainer: Marty Hiatt ;; Homepage: https://codeberg.org/martianh/mastodon.el ;; This file is not part of GNU Emacs. diff --git a/lisp/mastodon-discover.el b/lisp/mastodon-discover.el index 9278432..993cc27 100644 --- a/lisp/mastodon-discover.el +++ b/lisp/mastodon-discover.el @@ -3,8 +3,8 @@ ;; Copyright (C) 2019 Johnson Denen ;; Copyright (C) 2020-2024 Marty Hiatt ;; Author: Johnson Denen -;; Marty Hiatt -;; Maintainer: Marty Hiatt +;; Marty Hiatt +;; Maintainer: Marty Hiatt ;; Homepage: https://codeberg.org/martianh/mastodon.el ;; This file is not part of GNU Emacs. diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el index 5035cb4..1093de1 100644 --- a/lisp/mastodon-http.el +++ b/lisp/mastodon-http.el @@ -3,8 +3,8 @@ ;; Copyright (C) 2017-2019 Johnson Denen ;; Copyright (C) 2020-2024 Marty Hiatt ;; Author: Johnson Denen -;; Marty Hiatt -;; Maintainer: Marty Hiatt +;; Marty Hiatt +;; Maintainer: Marty Hiatt ;; Homepage: https://codeberg.org/martianh/mastodon.el ;; This file is not part of GNU Emacs. diff --git a/lisp/mastodon-inspect.el b/lisp/mastodon-inspect.el index adc6d64..4981943 100644 --- a/lisp/mastodon-inspect.el +++ b/lisp/mastodon-inspect.el @@ -3,8 +3,8 @@ ;; Copyright (C) 2017-2019 Johnson Denen ;; Copyright (C) 2020-2024 Marty Hiatt ;; Author: Johnson Denen -;; Marty Hiatt -;; Maintainer: Marty Hiatt +;; Marty Hiatt +;; Maintainer: Marty Hiatt ;; Homepage: https://codeberg.org/martianh/mastodon.el ;; This file is not part of GNU Emacs. diff --git a/lisp/mastodon-iso.el b/lisp/mastodon-iso.el index 8ea5635..6199cbe 100644 --- a/lisp/mastodon-iso.el +++ b/lisp/mastodon-iso.el @@ -1,7 +1,7 @@ ;;; mastodon-iso.el --- ISO language code lists for mastodon.el -*- lexical-binding: t -*- ;; Copyright (C) 2022 Marty Hiatt -;; Author: Marty Hiatt +;; Author: Marty Hiatt ;; Homepage: https://codeberg.org/martianh/mastodon.el ;; This file is not part of GNU Emacs. diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index ccd258c..8601410 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -3,8 +3,8 @@ ;; Copyright (C) 2017-2019 Johnson Denen ;; Copyright (C) 2020-2024 Marty Hiatt ;; Author: Johnson Denen -;; Marty Hiatt -;; Maintainer: Marty Hiatt +;; Marty Hiatt +;; Maintainer: Marty Hiatt ;; Homepage: https://codeberg.org/martianh/mastodon.el ;; This file is not part of GNU Emacs. diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index 8d2c928..b16b5a6 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -3,8 +3,8 @@ ;; Copyright (C) 2017-2019 Johnson Denen ;; Copyright (C) 2020-2024 Marty Hiatt ;; Author: Johnson Denen -;; Marty Hiatt -;; Maintainer: Marty Hiatt +;; Marty Hiatt +;; Maintainer: Marty Hiatt ;; Homepage: https://codeberg.org/martianh/mastodon.el ;; This file is not part of GNU Emacs. diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index c6a0276..40f834c 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -3,8 +3,8 @@ ;; Copyright (C) 2017-2019 Johnson Denen ;; Copyright (C) 2020-2024 Marty Hiatt ;; Author: Johnson Denen -;; Marty Hiatt -;; Maintainer: Marty Hiatt +;; Marty Hiatt +;; Maintainer: Marty Hiatt ;; Homepage: https://codeberg.org/martianh/mastodon.el ;; This file is not part of GNU Emacs. diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el index cead17e..25db7d8 100644 --- a/lisp/mastodon-search.el +++ b/lisp/mastodon-search.el @@ -1,8 +1,8 @@ ;;; mastodon-search.el --- Search functions for mastodon.el -*- lexical-binding: t -*- ;; Copyright (C) 2017-2019 Marty Hiatt -;; Author: Marty Hiatt -;; Maintainer: Marty Hiatt +;; Author: Marty Hiatt +;; Maintainer: Marty Hiatt ;; Homepage: https://codeberg.org/martianh/mastodon.el ;; This file is not part of GNU Emacs. diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 437a5e3..1a4df7f 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -3,8 +3,8 @@ ;; Copyright (C) 2017-2019 Johnson Denen ;; Copyright (C) 2020-2024 Marty Hiatt ;; Author: Johnson Denen -;; Marty Hiatt -;; Maintainer: Marty Hiatt +;; Marty Hiatt +;; Maintainer: Marty Hiatt ;; Homepage: https://codeberg.org/martianh/mastodon.el ;; This file is not part of GNU Emacs. diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 95fccc3..fc5825a 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -3,8 +3,8 @@ ;; Copyright (C) 2017-2019 Johnson Denen ;; Copyright (C) 2020-2024 Marty Hiatt ;; Author: Johnson Denen -;; Marty Hiatt -;; Maintainer: Marty Hiatt +;; Marty Hiatt +;; Maintainer: Marty Hiatt ;; Homepage: https://codeberg.org/martianh/mastodon.el ;; This file is not part of GNU Emacs. diff --git a/lisp/mastodon-transient.el b/lisp/mastodon-transient.el index fe70eac..526dfa4 100644 --- a/lisp/mastodon-transient.el +++ b/lisp/mastodon-transient.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2024 martian hiatus -;; Author: martian hiatus +;; Author: martian hiatus ;; Keywords: convenience ;; This program is free software; you can redistribute it and/or modify diff --git a/lisp/mastodon-views.el b/lisp/mastodon-views.el index 3112c20..8d356fb 100644 --- a/lisp/mastodon-views.el +++ b/lisp/mastodon-views.el @@ -1,8 +1,8 @@ ;;; mastodon-views.el --- Minor views functions for mastodon.el -*- lexical-binding: t -*- ;; Copyright (C) 2020-2024 Marty Hiatt -;; Author: Marty Hiatt -;; Maintainer: Marty Hiatt +;; Author: Marty Hiatt +;; Maintainer: Marty Hiatt ;; Homepage: https://codeberg.org/martianh/mastodon.el ;; This file is not part of GNU Emacs. diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 37da99c..cb5731a 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -4,8 +4,8 @@ ;; Copyright (C) 2020-2022 Marty Hiatt ;; Copyright (C) 2021 Abhiseck Paira ;; Author: Johnson Denen -;; Marty Hiatt -;; Maintainer: Marty Hiatt +;; Marty Hiatt +;; Maintainer: Marty Hiatt ;; Version: 1.1.0 ;; Package-Requires: ((emacs "28.1") (request "0.3.0") ;; (persist "0.4") (tp "0.1")) diff --git a/mastodon.texi b/mastodon.texi index dafa92d..d1c9268 100644 --- a/mastodon.texi +++ b/mastodon.texi @@ -818,7 +818,7 @@ There's no need for a blank line after the first docstring line (one is added au If you'd like to support continued development of @samp{mastodon.el}, I accept donations via paypal: @uref{https://paypal.me/martianh, paypal.me/martianh}. If you would prefer a different -payment method, please write to me at and I can +payment method, please write to me at and I can provide IBAN or other bank account details. I don't have a tech worker's income, so even a small tip would help out. -- cgit v1.2.3