Skip to content

Commit 9de20a2

Browse files
fixup! FIX louietan#76: handle both old and new function signatures of `request--curl-callback'
Check for the new 3-arg arity. By default, expect the stable, 2-arg arity from 'request.el'
1 parent b543552 commit 9de20a2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

anki-editor.el

+8-8
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,14 @@ See https://apps.ankiweb.net/docs/manual.html#latex-conflicts.")
166166
;; why here we manually invoke callbacks to receive the result.
167167
(unless (request-response-done-p response)
168168
;; (request--curl-callback "localhost" (get-buffer-process (request-response--buffer response)) "finished\n")))
169-
(if (equalp '(2 . 2) (func-arity 'request--curl-callback))
170-
;; Handle the older, stable version of 'request.el' in which
171-
;; `request--curl-callback' has two args.
172-
(request--curl-callback (get-buffer-process (request-response--buffer response)) "finished\n")
173-
;; Handle new 3-argument function signature as of 'request.el' commit
174-
;; '8ccbae1b5e5e2ae68112dd46a6bee67d318b0deb'. Should fix anki-editor
175-
;; errors for those using newer versions of 'request.el'.
176-
(request--curl-callback url (get-buffer-process (request-response--buffer response)) "finished\n"))))
169+
(if (equalp '(3 . 3) (func-arity 'request--curl-callback))
170+
;; Handle new 3-argument function signature as of 'request.el' commit
171+
;; '8ccbae1b5e5e2ae68112dd46a6bee67d318b0deb'. Should fix anki-editor
172+
;; errors for those using newer versions of 'request.el'.
173+
(request--curl-callback url (get-buffer-process (request-response--buffer response)) "finished\n")
174+
;; Handle the older, stable version of 'request.el' in which
175+
;; `request--curl-callback' has two args.
176+
(request--curl-callback (get-buffer-process (request-response--buffer response)) "finished\n"))))
177177

178178
(when err (error "Error communicating with AnkiConnect using cURL: %s" err))
179179
(or reply (error "Got empty reply from AnkiConnect"))))

0 commit comments

Comments
 (0)