aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-http.el
diff options
context:
space:
mode:
authorHolger Dürer <me@hdurer.net>2021-11-02 21:25:18 +0100
committerHolger Dürer <me@hdurer.net>2021-11-06 16:15:00 +0100
commitd0bf4f196a9a30ea4e19b0b6fa5f9c5bfaf695b3 (patch)
tree32f718b43fc5e32b12df199da528effb125b9d3e /lisp/mastodon-http.el
parent64bfd211fd48b674c1fa4d65d5b61ac86331d8e5 (diff)
Convert most uses of `(cdr (assoc <some-symbol> <a-list>))` to `(alist-get <some-symbol> <a-list>)`
This is more readable and actually more efficient (maybe) since it uses `eq` rather than `equal` as a test.
Diffstat (limited to 'lisp/mastodon-http.el')
-rw-r--r--lisp/mastodon-http.el10
1 files changed, 5 insertions, 5 deletions
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index 3e27e13..a45b4ed 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -88,7 +88,7 @@ Message status and JSON error from RESPONSE if unsuccessful."
(progn
(switch-to-buffer response)
(let ((json-response (mastodon-http--process-json)))
- (message "Error %s: %s" status (cdr (assoc 'error json-response))))))))
+ (message "Error %s: %s" status (alist-get 'error json-response)))))))
(defun mastodon-http--read-file-as-string (filename)
"Read a file FILENAME as a string. Used to generate image preview."
@@ -267,13 +267,13 @@ item uploaded, and `mastodon-toot--update-status-fields' is run."
(lambda (&key data &allow-other-keys)
(when data
(progn
- (push (cdr (assoc 'id data))
+ (push (alist-get 'id data)
mastodon-toot--media-attachment-ids) ; add ID to list
(message "%s file %s with id %S and caption '%s' uploaded!"
- (capitalize (cdr (assoc 'type data)))
+ (capitalize (alist-get 'type data))
file
- (cdr (assoc 'id data))
- (cdr (assoc 'description data)))
+ (alist-get 'id data)
+ (alist-get 'description data))
(mastodon-toot--update-status-fields)))))
:error (cl-function
(lambda (&key error-thrown &allow-other-keys)