aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-client.el
diff options
context:
space:
mode:
authorHolger Dürer <me@hdurer.net>2017-05-16 21:09:58 +0100
committerJohnson Denen <johnson.denen@gmail.com>2017-05-18 10:21:21 -0400
commitfe8e4386eacb358df0e16dc5bd37dde4f4d6d57c (patch)
tree2329c867ca4d8434e6e2200aae4f827e7f2a9165 /lisp/mastodon-client.el
parent5f41086d3a03e8781aab77ab17f4d4f95263e07c (diff)
Remove most byte-compile warnings.
We do this by - moving vars into the files where they are (mostly) used - "declaring" vars used elsewhere with the (defvar <var-name>) pattern, - declaring functions defined in others functions rather than loading the file via require.
Diffstat (limited to 'lisp/mastodon-client.el')
-rw-r--r--lisp/mastodon-client.el30
1 files changed, 16 insertions, 14 deletions
diff --git a/lisp/mastodon-client.el b/lisp/mastodon-client.el
index f8e8a5c..3a9a606 100644
--- a/lisp/mastodon-client.el
+++ b/lisp/mastodon-client.el
@@ -30,14 +30,16 @@
;;; Code:
(require 'plstore)
-(require 'mastodon-http nil t)
+(declare-function mastodon-http--api "mastodon-http")
+(declare-function mastodon-http--post "mastodon-http")
-(defgroup mastodon-client nil
- "Register your client with Mastodon."
- :prefix "mastodon-client-"
- :group 'mastodon)
-(defvar mastodon-client nil
+(defcustom mastodon-client--token-file (concat user-emacs-directory "mastodon.plstore")
+ "File path where Mastodon access tokens are stored."
+ :group 'mastodon
+ :type 'file)
+
+(defvar mastodon-client--client-details nil
"Client id and secret.")
(defun mastodon-client--register ()
@@ -62,11 +64,11 @@
(json-read-from-string json-string))))
(defun mastodon-client--token-file ()
- "Return `mastodon-token-file'."
- mastodon-token-file)
+ "Return `mastodon-client--token-file'."
+ mastodon-client--token-file)
(defun mastodon-client--store ()
- "Store client_id and client_secret in `mastodon-token-file'.
+ "Store client_id and client_secret in `mastodon-client--token-file'.
Make `mastodon-client--fetch' call to determine client values."
(let ((plstore (plstore-open (mastodon-client--token-file)))
@@ -77,19 +79,19 @@ Make `mastodon-client--fetch' call to determine client values."
client))
(defun mastodon-client--read ()
- "Retrieve client_id and client_secret from `mastodon-token-file'."
+ "Retrieve client_id and client_secret from `mastodon-client--token-file'."
(let* ((plstore (plstore-open (mastodon-client--token-file)))
(mastodon (plstore-get plstore "mastodon")))
(when mastodon
(delete "mastodon" mastodon))))
(defun mastodon-client ()
- "Return variable `mastodon-client' plist.
+ "Return variable `mastodon-client--client-details' plist.
-Read plist from `mastodon-token-file' if variable is nil.
+Read plist from `mastodon-client--token-file' if variable is nil.
Fetch and store plist if `mastodon-client--read' returns nil."
- (or mastodon-client
- (setq mastodon-client
+ (or mastodon-client--client-details
+ (setq mastodon-client--client-details
(or (mastodon-client--read)
(mastodon-client--store)))))