Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong number of arguments: request--curl-callback, 2 #76

Open
Honeypot95 opened this issue Sep 10, 2020 · 4 comments
Open

Wrong number of arguments: request--curl-callback, 2 #76

Honeypot95 opened this issue Sep 10, 2020 · 4 comments

Comments

@Honeypot95
Copy link

I started getting this error after a fresh recompilation of emacs from the latest feature/native-comp. Despite the error, the cards get pushed to anki. The problem is the echo message and the fact that instead of writing the ANKI_NOTE_ID field, I get an error field.

After some investigation, I discovered that the request.el package has changed the signature of the request--curl-callback function, about 10 months ago, from (proc event) (url proc event). It passes the extra url argument to another function request--curl-preprocess, for which the url argument is optional.

Adding a url such as "localhost" to the function anki-editor--anki-connect-invoke which is the function that calls request--curl-callback gets rid of the error field and brings back the ANKI_NOTE_ID field. But this still keeps a different error in the message buffer.

@BlindingDark
Copy link

workaround:

(defun anki-editor--anki-connect-invoke! (orig-fun &rest args)
    (let ((request--curl-callback
           (lambda (proc event) (request--curl-callback "localhost" proc event))))
      (apply orig-fun args)))

(advice-add 'anki-editor--anki-connect-invoke :around #'anki-editor--anki-connect-invoke!)

@sprajagopal
Copy link

sprajagopal commented Oct 22, 2020

@BlindingDark tried this, didn't work for me. I also opened an issue #78 which may be related to this.
I'm gonna try and roll back the request package and see if that works too.

EDIT:
Previous workaround may still work for you. My configuration had other issues

@BlindingDark
Copy link

BlindingDark commented Oct 22, 2020

@sprajagopal
The above method just add first parameter "localhost" to request--curl-callback.
If it doesn't work for you, you can try to modify the source file directly.
Just change https://github.com/louietan/anki-editor/blob/master/anki-editor.el#L161

(request--curl-callback (get-buffer-process (request-response--buffer response)) "finished\n")))

to

(request--curl-callback "localhost" (get-buffer-process (request-response--buffer response)) "finished\n")))

I did not encounter the second error(about ANKI_NOTE_ID), so your problem may be related to it.

@sprajagopal
Copy link

@BlindingDark That worked!
Everything's smooth now. Even the ANKI_NOTE_ID is updated properly now.

benj-schmidt added a commit to benj-schmidt/anki-editor that referenced this issue Feb 12, 2022
Sodel-the-Vociferous added a commit to Sodel-the-Vociferous/anki-editor that referenced this issue Jul 2, 2022
…est--curl-callback'

'request.el' commit '8ccbae1b5e5e2ae68112dd46a6bee67d318b0deb' changed the
function signature ("arity") from 2 to 3 arguments. The current stable version
of that package still uses the old number of args. The rolling-release master
branch of 'request.el' uses the new number of args. This function handles both
cases for the time being.

(It is generally frowned upon to use provate functions from other packages since
they are not considered a stable interface. However, for now, it is unavoidable
since there is no "stable" interface to forec 'request.el' to run the callback.)
Sodel-the-Vociferous added a commit to Sodel-the-Vociferous/anki-editor that referenced this issue Jul 4, 2022
Sodel-the-Vociferous added a commit to Sodel-the-Vociferous/anki-editor that referenced this issue Jul 4, 2022
…f `request--curl-callback'

Check for the new 3-arg arity. By default, expect the stable, 2-arg arity from
'request.el'
ermanno added a commit to ermanno/.emacs.d that referenced this issue Sep 24, 2022
This patch:
- updates the local deps
- adds an advice from:
louietan/anki-editor#76 to address the
problem when pushing notes to Anki (notes were successfully pushed,
however we didn't get the id of the note, which is necessary to be
able to later update the note
tarsius pushed a commit to emacsmirror/anki-editor that referenced this issue Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants