diff options
-rw-r--r-- | README.org | 1 | ||||
-rw-r--r-- | lisp/mastodon-tl.el | 78 | ||||
-rw-r--r-- | lisp/mastodon-toot.el | 6 | ||||
-rw-r--r-- | mastodon.info | 81 | ||||
-rw-r--r-- | mastodon.texi | 22 |
5 files changed, 120 insertions, 68 deletions
@@ -140,6 +140,7 @@ not contain =:client_id= and =:client_secret=. | =,= | view favouriters of toot at point | | =.= | view boosters of toot at point | | =/= | switch between mastodon buffers | +| =Z= | report user/toot at point to instances moderators | |----------------+---------------------------------------------------------------------------------| | | *Other views* | | =s= | search (posts, users, tags) (NB: only posts you have interacted with) | diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index a567544..ac15f7b 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -140,7 +140,9 @@ nil." (locked . ("🔒" . "[locked]")) (private . ("🔒" . "[followers]")) (direct . ("✉" . "[direct]")) - (edited . ("✍" . "[edited]"))) + (edited . ("✍" . "[edited]")) + (replied . ("⬇" . "↓")) + (reply-bar . ("┃" . "|"))) "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." @@ -749,7 +751,7 @@ links in the text. If TOOT is nil no parsing occurs." (insert string) (let ((shr-use-fonts mastodon-tl--enable-proportional-fonts) (shr-width (when mastodon-tl--enable-proportional-fonts - (- (window-width) 1)))) + (- (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: @@ -1264,8 +1266,21 @@ Runs `mastodon-tl--render-text' and fetches poll or media." (mastodon-tl--get-poll toot)) (mastodon-tl--media toot)))) +(defun mastodon-tl--prev-toot-id () + "Return the id of the last toot inserted into the buffer." + (let ((prev-pos (1- (save-excursion + (previous-single-property-change + (point) + 'base-toot-id))))) + (get-text-property prev-pos 'base-toot-id))) + +(defun mastodon-tl--after-reply-status (reply-to-id) + "T if REPLY-TO-ID is equal to that of the last toot inserted in the bufer." + (let ((prev-id (mastodon-tl--prev-toot-id))) + (string= reply-to-id prev-id))) + (defun mastodon-tl--insert-status (toot body author-byline action-byline - &optional id base-toot detailed-p) + &optional id base-toot detailed-p thread) "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 @@ -1280,14 +1295,30 @@ attached as a `toot-id' property if provided. If the status is a favourite or boost notification, BASE-TOOT is the JSON of the toot responded to. DETAILED-P means display more detailed info. For now -this just means displaying toot client." - (let ((start-pos (point))) +this just means displaying toot client. +THREAD means the status will be displayed in a thread view." + (let* ((start-pos (point)) + (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)))) (insert (propertize - (concat "\n" - body - " \n" - (mastodon-tl--byline toot author-byline action-byline detailed-p)) + (concat + "\n" + (if (and after-reply-status-p thread) + (concat (mastodon-tl--symbol 'replied) + "\n") + "") + (if (and after-reply-status-p thread) + (let ((bar (mastodon-tl--symbol 'reply-bar))) + (propertize body + 'line-prefix bar + 'wrap-prefix bar)) + body) + ;; body + " \n" + (mastodon-tl--byline toot author-byline action-byline detailed-p)) 'toot-id (or id ; notification's own id (alist-get 'id toot)) ; toot id 'base-toot-id (mastodon-tl--toot-id @@ -1363,10 +1394,11 @@ To disable showing the stats, customize (and (null (mastodon-tl--field 'in_reply_to_id toot)) (not (mastodon-tl--field 'rebloged toot)))) -(defun mastodon-tl--toot (toot &optional detailed-p) +(defun mastodon-tl--toot (toot &optional detailed-p thread) "Format TOOT and insert it into the buffer. DETAILED-P means display more detailed info. For now -this just means displaying toot client." +this just means displaying toot client. +THREAD means the status will be displayed in a thread view." (mastodon-tl--insert-status toot (mastodon-tl--clean-tabs-and-nl @@ -1377,12 +1409,15 @@ this just means displaying toot client." 'mastodon-tl--byline-boosted nil nil - detailed-p)) + detailed-p + thread)) -(defun mastodon-tl--timeline (toots) +(defun mastodon-tl--timeline (toots &optional thread) "Display each toot in TOOTS. -This function removes replies if user required." - (mapc #'mastodon-tl--toot +This function removes replies if user required. +THREAD means the status will be displayed in a thread view." + (mapc (lambda (toot) + (mastodon-tl--toot toot nil thread)) ;; hack to *not* filter replies on profiles: (if (eq (mastodon-tl--get-buffer-type) 'profile-statuses) toots @@ -1739,13 +1774,15 @@ view all branches of a thread." (mastodon-tl--set-buffer-spec buffer endpoint #'mastodon-tl--thread) - (mastodon-tl--timeline (alist-get 'ancestors context)) + (mastodon-tl--timeline (alist-get 'ancestors context) + :thread) (goto-char (point-max)) (move-marker marker (point)) ;; print re-fetched toot: - (mastodon-tl--toot toot :detailed-p) - (mastodon-tl--timeline (alist-get 'descendants context)) - ;; put point at the toot: + (mastodon-tl--toot toot :detailed-p :thread) + (mastodon-tl--timeline (alist-get 'descendants context) + :thread) + ;; put point at the toot: (goto-char (marker-position marker)) (mastodon-tl--goto-next-toot)))) ;; else just print the lone toot: @@ -2098,7 +2135,8 @@ PREFIX is sent to `mastodon-tl--show-tag-timeline', which see." (defun mastodon-tl--some-followed-tags-timeline (&optional prefix) "Prompt for some tags, and open a timeline for them. -The suggestions are from followed tags, but any other tags are also allowed." +The suggestions are from followed tags, but any other tags are also allowed. +PREFIX us sent to `mastodon-tl--show-tag-timeline', which see." (interactive "p") (let* ((followed-tags-json (mastodon-tl--followed-tags)) (tags (mastodon-tl--map-alist 'name followed-tags-json)) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 5dbdd05..269a9b4 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -225,14 +225,14 @@ send.") "\\([(\n\t ]\\|^\\)" "\\(?2:@[0-9a-zA-Z._-]+" ; a handle "\\(@[^ \n\t]*\\)?\\)" ; with poss domain, * = allow only @ - "\\b")) + "\\(\\b\\|'\\)")) ; boundary or ' char (defvar mastodon-toot-tag-regex (concat ;; preceding bracket, space or bol [boundary doesn't work with #] "\\([(\n\t ]\\|^\\)" "\\(?2:#[0-9a-zA-Z_]+\\)" ; tag - "\\b")) ; boundary + "\\(\\b\\|'\\)")) ; boundary or ' char (defvar mastodon-toot-url-regex ;; adapted from ffap-url-regexp @@ -845,7 +845,6 @@ instance to edit a toot." (mastodon-http--triage response (lambda () - (setq masto-poll-toot-response response) (mastodon-toot--kill) (if scheduled (message "Toot scheduled!") @@ -962,7 +961,6 @@ eg. \"feduser@fed.social\" -> \"@feduser@fed.social\"." The mentioned users look like this: Local user (including the logged in): `username`. Federated user: `username@host.co`." - (interactive) (let* ((boosted (mastodon-tl--field 'reblog status)) (mentions (if boosted diff --git a/mastodon.info b/mastodon.info index 6d8ba6d..d1389a1 100644 --- a/mastodon.info +++ b/mastodon.info @@ -57,8 +57,8 @@ File: mastodon.info, Node: README, Prev: Top, Up: Top ******** ‘mastodon.el’ is an Emacs client for the AcitivityPub social networks -that implement the Mastodon API. For info see -<https://joinmastodon.org/>. +that implement the Mastodon API. For info see joinmastodon.org +(https://joinmastodon.org/). * Menu: @@ -237,6 +237,7 @@ your ‘mastodon-token-file’ does not contain ‘:client_id’ and ‘,’ view favouriters of toot at point ‘.’ view boosters of toot at point ‘/’ switch between mastodon buffers + ‘Z’ report user/toot at point to instances moderators *Other views* ‘s’ search (posts, users, tags) (NB: only posts you have interacted with) ‘I’, ‘c’, ‘d’ view, create, and delete filters @@ -278,8 +279,10 @@ your ‘mastodon-token-file’ does not contain ‘:client_id’ and Marker Meaning -------------------------------------------- - ‘(B)’ I boosted this toot - ‘(F)’ I favourited this toot + ‘(🔁)’ (or I boosted this toot + ‘(B)’) + ‘(⭐)’ (or I favourited this toot + ‘(F)’) ‘(🔖)’ (or I bookmarked this toot (‘K’)) @@ -389,6 +392,10 @@ and should work without first loading ‘mastodon.el’: • ‘mastodon-tl--unfollow-tag’: Unfollow a tag • ‘mastodon-tl--list-followed-tags’: View a list of tags you’re following. + • ‘mastodon-tl--followed-tags-timeline’: View a timeline of all your + followed tags. + • ‘mastodon-tl--some-followed-tags-timleine’: View a timeline of + multiple tags, from your followed tags or any other. • ‘mastodon-switch-to-buffer’: switch between mastodon buffers. @@ -444,7 +451,8 @@ File: mastodon.info, Node: Alternative timeline layout, Next: Live-updating ti The incomparable Nicholas Rougier has written an alternative timeline layout for ‘mastodon.el’. - The repo is at <https://github.com/rougier/mastodon-alt>. + The repo is at mastodon-alt +(https://github.com/rougier/mastodon-alt). File: mastodon.info, Node: Live-updating timelines mastodon-async-mode, Next: Translating toots, Prev: Alternative timeline layout, Up: Usage @@ -452,7 +460,8 @@ File: mastodon.info, Node: Live-updating timelines mastodon-async-mode, Next: 1.2.7 Live-updating timelines: ‘mastodon-async-mode’ ---------------------------------------------------- -(code taken from <https://github.com/alexjgriffith/mastodon-future.el>.) +(code taken from mastodon-future +(https://github.com/alexjgriffith/mastodon-future.el).) Works for federated, local, and home timelines and for notifications. It’s a little touchy, one thing to avoid is trying to load a timeline @@ -473,7 +482,7 @@ File: mastodon.info, Node: Translating toots, Next: bookmarks and mastodonel, You can translate toots with ‘mastodon-toot--translate-toot-text’ (‘a’ in a timeline). At the moment this requires lingva.el (https://codeberg.org/martianh/lingva.el), a little interface I wrote to -<https://lingva.ml>, to be installed to work. +lingva.ml (https://lingva.ml), to be installed to work. You could easily modify the simple function to use your Emacs translator of choice (‘libretrans.el’ , ‘google-translate’, ‘babel’, @@ -510,8 +519,8 @@ File: mastodon.info, Node: Dependencies, Next: Network compatibility, Prev: U ================ Hard dependencies (should all install with ‘mastodon.el’): - • ‘request’ (for uploading attachments), - <https://github.com/tkf/emacs-request> + • ‘request’ (for uploading attachments), emacs-request + (https://github.com/tkf/emacs-request) • ‘persist’ for storing some settings across sessions • ‘ts’ for poll relative expiry times @@ -602,7 +611,7 @@ File: mastodon.info, Node: Supporting mastodonel, Next: Contributors, Prev: C ============================ If you’d like to support continued development of ‘mastodon.el’, I -accept donations via paypal: https://paypal.me/martianh +accept donations via paypal: paypal.me/martianh (https://paypal.me/martianh). If you would prefer a different payment method, write to me at that address and I can provide IBAN or other details. @@ -631,32 +640,32 @@ File: mastodon.info, Node: Contributors, Prev: Supporting mastodonel, Up: REA Tag Table: Node: Top210 Node: README911 -Node: Installation1310 -Node: MELPA1846 -Node: Emoji2214 -Node: Discover2546 -Node: Usage3098 -Node: Logging in to your instance3508 -Node: Timelines4505 -Ref: Keybindings4980 -Ref: Toot byline legend9469 -Node: Composing toots9741 -Ref: Keybindings (1)11318 -Ref: Draft toots11836 -Node: Other commands and account settings12307 -Node: Customization15235 -Node: Alternative timeline layout16021 -Node: Live-updating timelines mastodon-async-mode16398 -Node: Translating toots17234 -Node: bookmarks and mastodonel18406 -Node: Dependencies18876 -Node: Network compatibility19468 -Node: Contributing19954 -Node: Bug reports20243 -Node: Fixes and features21149 -Node: Coding style21632 -Node: Supporting mastodonel22256 -Node: Contributors22786 +Node: Installation1327 +Node: MELPA1863 +Node: Emoji2231 +Node: Discover2563 +Node: Usage3115 +Node: Logging in to your instance3525 +Node: Timelines4522 +Ref: Keybindings4997 +Ref: Toot byline legend9570 +Node: Composing toots9879 +Ref: Keybindings (1)11456 +Ref: Draft toots11974 +Node: Other commands and account settings12445 +Node: Customization15603 +Node: Alternative timeline layout16389 +Node: Live-updating timelines mastodon-async-mode16779 +Node: Translating toots17631 +Node: bookmarks and mastodonel18813 +Node: Dependencies19283 +Node: Network compatibility19889 +Node: Contributing20375 +Node: Bug reports20664 +Node: Fixes and features21570 +Node: Coding style22053 +Node: Supporting mastodonel22677 +Node: Contributors23199 End Tag Table diff --git a/mastodon.texi b/mastodon.texi index dee530f..122bbb1 100644 --- a/mastodon.texi +++ b/mastodon.texi @@ -70,7 +70,7 @@ Contributing @chapter README @samp{mastodon.el} is an Emacs client for the AcitivityPub social networks that -implement the Mastodon API@. For info see @uref{https://joinmastodon.org/}. +implement the Mastodon API@. For info see @uref{https://joinmastodon.org/, joinmastodon.org}. @menu * Installation:: @@ -267,6 +267,8 @@ not contain @samp{:client_id} and @samp{:client_secret}. @tab view boosters of toot at point @item @samp{/} @tab switch between mastodon buffers +@item @samp{Z} +@tab report user/toot at point to instances moderators @item @tab @strong{Other views} @item @samp{s} @@ -348,9 +350,9 @@ not contain @samp{:client_id} and @samp{:client_secret}. @multitable {aaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaa} @headitem Marker @tab Meaning -@item @samp{(B)} +@item @samp{(🔁)} (or @samp{(B)}) @tab I boosted this toot -@item @samp{(F)} +@item @samp{(⭐)} (or @samp{(F)}) @tab I favourited this toot @item @samp{(🔖)} (or (@samp{K})) @tab I bookmarked this toot @@ -497,6 +499,10 @@ instance. @samp{mastodon-tl--unfollow-tag}: Unfollow a tag @item @samp{mastodon-tl--list-followed-tags}: View a list of tags you're following. +@item +@samp{mastodon-tl--followed-tags-timeline}: View a timeline of all your followed tags. +@item +@samp{mastodon-tl--some-followed-tags-timleine}: View a timeline of multiple tags, from your followed tags or any other. @end itemize @@ -580,12 +586,12 @@ Set default reply visibility The incomparable Nicholas Rougier has written an alternative timeline layout for @samp{mastodon.el}. -The repo is at @uref{https://github.com/rougier/mastodon-alt}. +The repo is at @uref{https://github.com/rougier/mastodon-alt, mastodon-alt}. @node Live-updating timelines @samp{mastodon-async-mode} @subsection Live-updating timelines: @samp{mastodon-async-mode} -(code taken from @uref{https://github.com/alexjgriffith/mastodon-future.el}.) +(code taken from @uref{https://github.com/alexjgriffith/mastodon-future.el, mastodon-future}.) Works for federated, local, and home timelines and for notifications. It's a little touchy, one thing to avoid is trying to load a timeline more than once @@ -600,7 +606,7 @@ view a timeline with one of the commands that begin with @subsection Translating toots You can translate toots with @samp{mastodon-toot--translate-toot-text} (@samp{a} in a timeline). At the moment -this requires @uref{https://codeberg.org/martianh/lingva.el, lingva.el}, a little interface I wrote to @uref{https://lingva.ml}, to +this requires @uref{https://codeberg.org/martianh/lingva.el, lingva.el}, a little interface I wrote to @uref{https://lingva.ml, lingva.ml}, to be installed to work. You could easily modify the simple function to use your Emacs translator of @@ -631,7 +637,7 @@ to your translator function as its text argument. Here's what Hard dependencies (should all install with @samp{mastodon.el}): @itemize @item -@samp{request} (for uploading attachments), @uref{https://github.com/tkf/emacs-request} +@samp{request} (for uploading attachments), @uref{https://github.com/tkf/emacs-request, emacs-request} @item @samp{persist} for storing some settings across sessions @item @@ -720,7 +726,7 @@ There's no need for a blank line after the first docstring line (one is added au @section Supporting @samp{mastodon.el} If you'd like to support continued development of @samp{mastodon.el}, I accept -donations via paypal: @uref{https://paypal.me/martianh, https://paypal.me/martianh}. If you would +donations via paypal: @uref{https://paypal.me/martianh, paypal.me/martianh}. If you would prefer a different payment method, write to me at that address and I can provide IBAN or other details. |