From ab0d01c525f2b44dd64ec09747daf0fced4bd9c7 Mon Sep 17 00:00:00 2001 From: SqrtMinusOne Date: Fri, 28 Jul 2023 14:25:39 +0300 Subject: [PATCH] fix(emacs): mastodon timeline transient --- .emacs.d/init.el | 5 +---- Emacs.org | 16 ++++++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 80b1d0f..8dae14b 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -5885,7 +5885,7 @@ ENTRY is an instance of `elfeed-entry'." (remove-hook 'kill-emacs-hook #'my/mastodon-mode-line-persist-meta) (my/mastodon-mode-line-persist-meta))))) -(defun my/mastodon-get-update-funciton (hide-boosts hide-replies) +(defun my/mastodon-get-update-funciton (hide-replies hide-boosts) (lambda (toots) (let* ((is-profile (eq (mastodon-tl--get-buffer-type) 'profile-statuses)) (hide-replies (and (not is-profile) hide-replies)) @@ -5899,9 +5899,6 @@ ENTRY is an instance of `elfeed-entry'." (or (not hide-boosts) (not (alist-get 'reblog toot))))) toots))) - (message "Hide replies: %s" hide-replies) - (message "Hide boosts: %s" hide-boosts) - (message "Buffer: %s" (buffer-name)) (mapc #'mastodon-tl--toot toots)))) (defun my/mastodon-tl--get-home (hide-replies hide-boosts) diff --git a/Emacs.org b/Emacs.org index 4bf7375..6f4f3f1 100644 --- a/Emacs.org +++ b/Emacs.org @@ -8084,12 +8084,12 @@ Send =/detach= to all servers. Kinda strange that there's no such function alrea #+end_src *** Mastodon -Mastodon is a decentralized social media network. I use an instance called [[https://emacs.ch/][emacs.ch]] +Mastodon is a decentralized social media network. I use an instance called [[https://emacs.ch/][emacs.ch]]. **** Package configuration [[https://codeberg.org/martianh/mastodon.el][mastodon.el]] is an Emacs client for Mastodon. -The default UI is a bit rough, but Nicolas Rougier's [[https://github.com/rougier/mastodon-alt][mastodon-alt]] package makes things a bit more how I would like to see them. +The default UI is rather rough, but Nicolas Rougier's [[https://github.com/rougier/mastodon-alt][mastodon-alt]] package makes things a bit more how I would like to see them. #+begin_src emacs-lisp (use-package mastodon @@ -8168,6 +8168,8 @@ The package also doesn't have evil bindings. I implement a few basic bindings he **** Modeline segment This is my attempt to make a modeline indicator for new mastodon notifications. +Edit [2023-07-28 Fri]: I'll probably remove that, don't feel like it's actually useful. + #+begin_src emacs-lisp (defvar my/mastodon-mode-string "") @@ -8260,8 +8262,11 @@ This is my attempt to make a modeline indicator for new mastodon notifications. (my/mastodon-mode-line-persist-meta))))) #+end_src **** Timeline Transient +The default =mastodon-tl--get-home-timeline= allows only to hide replies, and not boosted posts. + +So here's a custom update function: #+begin_src emacs-lisp -(defun my/mastodon-get-update-funciton (hide-boosts hide-replies) +(defun my/mastodon-get-update-funciton (hide-replies hide-boosts) (lambda (toots) (let* ((is-profile (eq (mastodon-tl--get-buffer-type) 'profile-statuses)) (hide-replies (and (not is-profile) hide-replies)) @@ -8275,12 +8280,10 @@ This is my attempt to make a modeline indicator for new mastodon notifications. (or (not hide-boosts) (not (alist-get 'reblog toot))))) toots))) - (message "Hide replies: %s" hide-replies) - (message "Hide boosts: %s" hide-boosts) - (message "Buffer: %s" (buffer-name)) (mapc #'mastodon-tl--toot toots)))) #+end_src +In order to use it, the function has to be passed to =mastodon-tl--init=: #+begin_src emacs-lisp (defun my/mastodon-tl--get-home (hide-replies hide-boosts) (mastodon-tl--init @@ -8292,6 +8295,7 @@ This is my attempt to make a modeline indicator for new mastodon notifications. nil)) #+end_src +And a transient to use it. #+begin_src emacs-lisp (with-eval-after-load 'mastodon (require 'transient)