aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorAbhiseck Paira <abhiseckpaira@disroot.org>2022-01-17 19:40:59 +0530
committerAbhiseck Paira <abhiseckpaira@disroot.org>2022-01-17 19:40:59 +0530
commit8e36abecbb8fa0df1aba30b1100130e5e382b92b (patch)
tree1b88e0a00d6c5782e459639632ab45d5c6313629 /lisp
parentcd03ff5319dc60b4aa4f6d42f57b737e002cd923 (diff)
introduce a general plstore reading function
Introduce a general version of `mastodon-client--read'[1] with the name `mastodon-client--general-read'[2] as [1] is too specific. [2] can be called with with a plstore "key" to retrieve the item keyed by that KEY.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-client.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/lisp/mastodon-client.el b/lisp/mastodon-client.el
index 04a26ce..7a857a2 100644
--- a/lisp/mastodon-client.el
+++ b/lisp/mastodon-client.el
@@ -109,6 +109,13 @@ Make `mastodon-client--fetch' call to determine client values."
(mastodon (plstore-get plstore (concat "mastodon-" mastodon-instance-url))))
(mastodon-client--remove-key-from-plstore mastodon)))
+(defun mastodon-client--general-read (key)
+ "Retrieve the plstore item keyed by KEY.
+Return plist without the KEY."
+ (let* ((plstore (plstore-open (mastodon-client--token-file)))
+ (plstore-item (plstore-get plstore key)))
+ (mastodon-client--remove-key-from-plstore plstore-item)))
+
(defun mastodon-client ()
"Return variable client secrets to use for `mastodon-instance-url'.