request 0.3.1 assumes utf-8 (#53)

* request 0.3.1 assumes utf-8

The tkf library now defaults to utf-8 encoding (so does not need to be
done in anki-editor).  Further the synchronous bug has been fixed.

* must upgrade to request 0.3.1

* use melpa versioning

* Synch bug in request-20190730.1014

Hypothesis: synch bug is triggered depending on byte compilation of request-curl-callback.

* when-let issue

* restore "HACK: With sync set to t"

Package maintainer reports undowned semaphore with tkf/emacs-request library
f466ab1.  I don't believe restoring the "HACK" would cure this since
":sync t" remains.
This commit is contained in:
dickmao 2019-09-22 08:23:39 -04:00 committed by Lei Tan
parent 3e9f957ac5
commit 084ffad14f

View file

@ -146,7 +146,7 @@ See https://apps.ankiweb.net/docs/manual.html#latex-conflicts.")
anki-editor-anki-connect-listening-port)
:type "POST"
:parser 'json-read
:data (encode-coding-string request-body 'utf-8)
:data request-body
:success (cl-function (lambda (&key data &allow-other-keys)
(setq reply data)))
:error (cl-function (lambda (&key _ &key error-thrown &allow-other-keys)
@ -171,7 +171,7 @@ See https://apps.ankiweb.net/docs/manual.html#latex-conflicts.")
(defun anki-editor--anki-connect-invoke-multi (&rest actions)
(-zip-with (lambda (result handler)
(when-let (((listp result))
(when-let ((_ (listp result))
(err (alist-get 'error result)))
(error err))
(and handler (funcall handler result)))
@ -674,7 +674,7 @@ of that heading."
(message "[%d/%d] Processing notes in buffer \"%s\", wait a moment..."
(cl-incf acc) total (buffer-name))
(anki-editor--clear-failure-reason)
(condition-case err
(condition-case-unless-debug err
(anki-editor--push-note (anki-editor-note-at-point))
(error (cl-incf failed)
(anki-editor--set-failure-reason (error-message-string err)))))