Let's see if this doesn't annoy me. I'm not huge excited about any Mastodon client though.
use-package request)
(use-package mastodon
(
:configrequire 'mastodon-async)
(; <<list-timelines>>
<<setup-frame>>
:hook
(mastodon-mode . visual-line-mode)
:customt)
(mastodon-tl--show-avatars "https://notes.whatthefuck.computer")
(mastodon-instance-url "rrix"))
(mastodon-active-user provide 'cce/mastodon) (
here's a package override for my Emacs home-manager installation which uses a more-up-to-date fork:
(old: {
mastodon = epkgs.melpaPackages.mastodon.overrideAttrssrc = pkgs.callPackage pkgs.lib.pkgVersions.mastodon {};
propagatedBuildInputs = old.buildInputs ++ [epkgs.request epkgs.persist];
});
List Timelines in Mastodon.el
This uses the Mastodon.el API to fetch the lists, select one, and display it in a buffer.
defun mastodon-tl--show-list-timeline (&optional list-name)
(
(interactive)let* ((options
(lambda (car)
(cl-mapcar (cons (alist-get 'title car)
('id car)))
(alist-get format "lists")))))
(mastodon-http--get-json (mastodon-http--api (or list-name
(chosen-name (
(completing-read"Which list?"
#'car options))))
(cl-mapcar nil nil #'equal)))
(chosen-id (alist-get chosen-name options
(mastodon-tl--init"list-" chosen-name) (concat "timelines/list/" chosen-id) 'mastodon-tl--timeline))) (concat
Configure an Mastodon.el frame
And this configures a frame with my favorite buffers; i wish there was a cleaner way to do this, but alas. I have some scriplets in Emacs Helper Scripts to invoke this from KRunner/WM.
defun cce/my-mastodon.el-buffers ()
(
(interactive)"folks")
(mastodon-tl--show-list-timeline
(mastodon-notifications--get)
(mastodon-tl--get-home-timeline)"neatbots")
(mastodon-tl--show-list-timeline "Guppies")
(mastodon-tl--show-list-timeline "emacs")
(mastodon-tl--show-tag-timeline "orgmode")
(mastodon-tl--show-tag-timeline "gunpla")
(mastodon-tl--show-tag-timeline
5)
(sit-for
(cce/setup-mastodon-buffers))
defun cce/setup-mastodon-buffers ()
(
(interactive)
(delete-other-windows)
let ((actions ; list of buffer names
("*mastodon-notifications*"
'("*mastodon-list-folks*"
"*mastodon-home*"
"*mastodon-list-neatbots*"
"*mastodon-list-Guppies*"
"*mastodon-tag-orgmode*"
"*mastodon-tag-emacs*"
"*mastodon-tag-gunpla*"))
"\*mastodon.*" (display-buffer-same-window)))))
(display-buffer-alist '((dotimes (i (- (length actions) 1))
(
(split-window-right)
(balance-windows))dolist (buffer actions)
(
(display-buffer buffer)1)))) (other-window