diff --git a/core/cubes/mastodon.el b/core/cubes/mastodon.el new file mode 100644 index 0000000..27e6208 --- /dev/null +++ b/core/cubes/mastodon.el @@ -0,0 +1,61 @@ +;;; MastodonCube --- The Mastodon cube for FG42 -*- lexical-binding: t; -*- +;; +;; Copyright (c) 2010-2022 Sameer Rahmani & Contributors +;; +;; Author: Sameer Rahmani +;; URL: https://gitlab.com/FG42/FG42 +;; Version: 3.0.0 +;; +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . +;; +;;; Commentary: +;; Cubes are the building blocks of any `FG42' editor. Each `cube' is a +;; unit which defines different abilities in a deterministic and idempotent +;; way. Cubes are composable and a composition of cubes creates an editor. +;; +;;; Code: +(require 'fpkg) +(require 'fg42/cube) + + +(defcube fg42/mastodon-cube + "This cube provides an Emacs client for Mastodon. +Mastodon is a fediverse application and this cube enables *FG42* to interact +with a mastodon instance. + +Pass your instance url and user via =:instance-url= and =:user= keys to the +cube. + +For more info on check out [[https://codeberg.org/martianh/mastodon.el]]" + + (:title "Mastodone Cube" + :flag mastodon + :flag-default t) + + (let ((url (or (plist-get fg42/mastodon-cube-params :instance-url) + (error "Instance url is empty set the `:instance-url' key"))) + (user (or (plist-get fg42/mastodon-cube-params :user) + (error "User is empty set the `:user' key")))) + + (fpkg/use mastodon + :config + (progn + (when-flag discover + (mastodon-discover)) + (setq mastodon-instance-url url + mastodon-active-user user))))) + + +(provide 'cubes/mastodon) +;;; mastodon.el ends here