aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-http.el
diff options
context:
space:
mode:
authorHolger Dürer <me@hdurer.net>2021-11-05 18:33:16 +0100
committerHolger Dürer <me@hdurer.net>2021-11-06 16:15:34 +0100
commit65f80fd810793638beb6f146b25919bca5c21cfc (patch)
tree6489b585e2f9bdd69b9febfb4bf737d8b96356ff /lisp/mastodon-http.el
parentf67114cc6c5c167db7327b6b965839236e0466aa (diff)
Do a bit if `if` and `progn` sanitizing.
- A `progn` with a single form is redundant - `when` doesn't need a `progn` body - `if` has an implicit `progn` for the consequences - I converted one cascade of `if`s into a `cond`.
Diffstat (limited to 'lisp/mastodon-http.el')
-rw-r--r--lisp/mastodon-http.el24
1 files changed, 11 insertions, 13 deletions
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index a45b4ed..1ec0dc0 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -85,10 +85,9 @@ Message status and JSON error from RESPONSE if unsuccessful."
(mastodon-http--status))))
(if (string-prefix-p "2" status)
(funcall success)
- (progn
- (switch-to-buffer response)
- (let ((json-response (mastodon-http--process-json)))
- (message "Error %s: %s" status (alist-get 'error json-response)))))))
+ (switch-to-buffer response)
+ (let ((json-response (mastodon-http--process-json)))
+ (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."
@@ -266,15 +265,14 @@ item uploaded, and `mastodon-toot--update-status-fields' is run."
:success (cl-function
(lambda (&key data &allow-other-keys)
(when data
- (progn
- (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 (alist-get 'type data))
- file
- (alist-get 'id data)
- (alist-get 'description data))
- (mastodon-toot--update-status-fields)))))
+ (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 (alist-get 'type data))
+ file
+ (alist-get 'id data)
+ (alist-get 'description data))
+ (mastodon-toot--update-status-fields))))
:error (cl-function
(lambda (&key error-thrown &allow-other-keys)
(cond