diff options
author | Ian Eure <ian@retrospec.tv> | 2020-05-03 11:51:00 -0700 |
---|---|---|
committer | mousebot <mousebot@riseup.net> | 2021-05-09 11:22:59 +0200 |
commit | 6186a9b2f60f435106c181673db4552e1e1eaa85 (patch) | |
tree | d31a51714c601e36d490e12bd7760cb10b88da24 | |
parent | 4b621f58d294d7ab67ee4c800cd2777541bc1bee (diff) |
Guard against the old version of Emacs which mastodon.el supports.
-rw-r--r-- | lisp/mastodon-http.el | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el index a5f88d7..f26d808 100644 --- a/lisp/mastodon-http.el +++ b/lisp/mastodon-http.el @@ -36,7 +36,7 @@ (defvar mastodon-http--api-version "v1") (defconst mastodon-http--timeout 5 - "HTTP request timeout, in seconds.") + "HTTP request timeout, in seconds. Has no effect on Emacs < 26.1.") (defun mastodon-http--api (endpoint) "Return Mastondon API URL for ENDPOINT." @@ -89,7 +89,9 @@ Authorization header is included by default unless UNAUTHENTICED-P is non-nil." `(("Authorization" . ,(concat "Bearer " (mastodon-auth--access-token))))) headers))) (with-temp-buffer - (url-retrieve-synchronously url nil nil mastodon-http--timeout)))) + (if (< (cdr (func-arity 'url-retrieve-synchronously)) 4) + (url-retrieve-synchronously url) + (url-retrieve-synchronously url nil nil mastodon-http--timeout))))) (defun mastodon-http--get (url) "Make GET request to URL. @@ -99,7 +101,9 @@ Pass response buffer to CALLBACK function." (url-request-extra-headers `(("Authorization" . ,(concat "Bearer " (mastodon-auth--access-token)))))) - (url-retrieve-synchronously url nil nil mastodon-http--timeout))) + (if (< (cdr (func-arity 'url-retrieve-synchronously)) 4) + (url-retrieve-synchronously url) + (url-retrieve-synchronously url nil nil mastodon-http--timeout)))) (defun mastodon-http--delete (url) "Make DELETE request to URL. |