aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon.el
blob: f44b5c7a82a46084e82284b5b685eae39e5b2755 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
;;; mastodon.el -- Mastodon client for Emacs

;;; Commentary:

;; mastodon.el is an Emacs client for Mastodon, the federated microblogging
;; social network. It is very much a work-in-progress, but it is a labor of
;; love.

;;; Code:

(defgroup mastodon nil
  "Interface with Mastodon."
  :prefix "mastodon-"
  :group 'external)

(defcustom mastodon-instance-url "https://mastodon.social"
  "Base URL for the Masto instance from which you toot."
  :group 'mastodon
  :type 'string)

(defcustom mastodon-token-file (concat user-emacs-directory "mastodon.plstore")
  "File path where Mastodon access tokens are stored."
  :group 'mastodon
  :type 'file)

(defvar mastodon--api-version "v1")

(defun mastodon-version ()
  "Message package version."
  (interactive)
  (with-temp-buffer
    (insert-file-contents "../.version")
    (message
     (concat "mastodon.el v" (buffer-string)))))

;;;###autoload
(defun mastodon-toot ()
  "Update a Mastodon instance with new toot. Content is captured in a new buffer."
  (interactive)
  (progn
    (require 'mastodon-toot)
    (switch-to-buffer-other-window (get-buffer-create "*new toot*"))
    (mastodon-toot-mode t)))

;;;###autoload
(defun mastodon-register ()
  "Registers mastodon.el with the Mastodon instance."
  (interactive)
  (progn
    (require 'mastodon-auth)
    (mastodon--store-client-id-and-secret)))

(provide 'mastodon)
;;; mastodon.el ends here