Categories: mastodon

RSS - Atom - Subscribe via email

Collect my recent toots in an Org file so that I can refile them

| emacs, mastodon, org

I want to use my microblog posts on Mastodon as building blocks for longer posts on my blog. Getting them into an Org file makes it easier to link to them or refile them to other parts of my Org files so that I can build up my notes.

(use-package pandoc)
(defun my-mastodon-org-feed-formatter (entry)
  (concat "* " (pandoc-convert-stdio
                (dom-text (dom-by-tag
                           (with-temp-buffer
                             (insert "<item>"
                                     (plist-get entry :item-full-text)
                                     "</item>")
                             (xml-parse-region (point-min) (point-max)))
                           'description))
                "html" "org")
          "\n\n[" (format-time-string (cdr org-time-stamp-formats)
                                      (date-to-time (plist-get entry :pubDate)))
"]\n" (plist-get entry :link)))
(setq org-feed-alist '(("Mastodon" "https://emacs.ch/@sachac/with_replies.rss"
                        "~/sync/orgzly/toots.org" "Toots"
                        :formatter my-mastodon-org-feed-formatter)))
(defun my-org-feed-sort (pos entries)
  (save-excursion
    (goto-char pos)
    (when (looking-at org-complex-heading-regexp)
      (org-sort-entries nil ?T))))
(advice-add #'org-feed-add-items :after #'my-org-feed-sort)

Now I can use org-feed-update-all (C-c C-x g) to pull things into my toots.org file.

This is part of my Emacs configuration.

Solving the mastodon.el error mastodon-auth--access-token: invalid

| emacs, mastodon

If you get mastodon-auth--handle-token-response: Mastodon-auth--access-token: invalid_grant: The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client. while trying to set up mastodon.el from MELPA, you might have an outdated version. Try the following steps:

  • M-x package-delete mastodon
  • Restart Emacs
  • M-x package-refresh-contents
  • M-x package-install mastodon

If that doesn't work, try installing it from the Git repository: https://codeberg.org/martianh/mastodon.el.git

Posting this here to make it searchable.

On Mastodon: @sachac@emacs.ch

| emacs, geek, mastodon

Now that the kiddo's reasonably well-settled into virtual school and EmacsConf is chugging along nicely, I finally have a little time to explore Mastodon, a federated social network that quite a lot of people have been shifting to (and quite a lot of people have been on all along). When @louis@emacs.ch e-mailed me about including the new emacs.ch Mastodon instance in Emacs News, I figured I'd set up a profile for myself and have a look around.

I like to keep an eye on posts mentioning Emacs once in a while, which might be a little more complicated than it is on Twitter given the distributed nature of Mastodon. Anyway, if you post something you'd like me to include in Emacs News, please mention me at @sachac@emacs.ch. Thanks!

I've also set up a bot that posts things from planet.emacslife.com. It's at https://emacs.ch/@emacslife .

I tend to scroll through Mastodon on my phone or using mastodon.el, which is really nice for keyboard navigation.

Update 2022-11-14: I think I've set it up so that @sacha@sachachua.com resolves to my profile at emacs.ch, so you can use either @sacha@sachachua.com or @sachac@emacs.ch. Useful: https://blog.maartenballiauw.be/post/2022/11/05/mastodon-own-donain-without-hosting-server.html and https://willnorris.com/2014/07/webfinger-with-static-files-nginx/ (thanks, @maartenballiauw@mastodon.online !)

See y'all there!