From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Price Subject: [sort-of OT] Help with "request" and "deferred" Date: Wed, 28 Jan 2015 20:37:37 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1135e57e6e3c4d050dc08887 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37825) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGe3A-0004ZD-61 for emacs-orgmode@gnu.org; Wed, 28 Jan 2015 20:37:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGe38-0005HF-K1 for emacs-orgmode@gnu.org; Wed, 28 Jan 2015 20:37:40 -0500 Received: from mail-lb0-x232.google.com ([2a00:1450:4010:c04::232]:48683) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGe38-0005FW-6c for emacs-orgmode@gnu.org; Wed, 28 Jan 2015 20:37:38 -0500 Received: by mail-lb0-f178.google.com with SMTP id u10so23144518lbd.9 for ; Wed, 28 Jan 2015 17:37:37 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode --001a1135e57e6e3c4d050dc08887 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable in pursuit of the zotero integration I discussed in other threads, I am trying to write one simple little function to extend Erik's code, and failing. Since I'm flailing and going to bed soon: can anyone see what's wrong with this function? The results are generated perfectly well, but the return value of hte function is [cl-struct-deferred deferred:default-callback deferred:default-errorback deferred:default-cancel nil nil nil] [2 times] whereas I want something like: "
Suchman, Lucy. =E2=80=9CSubject Objects.=E2=80= =9D Feminist Theory 12, no. 2 (August 1, 2011): 119=E2=80=9345. http://resolver.scholarsportal.info/resolve/14647001/v12i0002/119_so.xml .
" ------- (defun org-zotxt-get-html-bib (key) ;; (with-output-to-temp-buffer "*help2*" ;; (print key)) (lexical-let ((d (deferred:new))) (request (format "%s/items" zotxt-url-base) :params `(("key" . ,key) ("format" . "bibliography")) :parser 'json-read :success (function* (lambda (&key data &allow-other-keys) ;; (with-output-to-temp-buffer "*debug*" ;; (print data)) (let* ((results (mapcar (lambda (e) (cdr (assq 'html e)) ) data)) ) (with-output-to-temp-buffer "*debug*" (print results)) (results) (deferred:callback-post d (if (null results) nil ;; `((:key ,key :citation ,results)) (results) )) )) ) ) d)) ------------------- thanks again! Matt --001a1135e57e6e3c4d050dc08887 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: base64 PGRpdiBkaXI9Imx0ciI+PGRpdj48ZGl2PmluIHB1cnN1aXQgb2YgdGhlIHpvdGVybyBpbnRlZ3Jh dGlvbiBJIGRpc2N1c3NlZCBpbiBvdGhlciB0aHJlYWRzLCBJIGFtIHRyeWluZyB0byB3cml0ZSBv bmUgc2ltcGxlIGxpdHRsZSBmdW5jdGlvbiB0byBleHRlbmQgRXJpayYjMzk7cyBjb2RlLCBhbmQg ZmFpbGluZy7CoCBTaW5jZSBJJiMzOTttIGZsYWlsaW5nIGFuZCBnb2luZyB0byBiZWQgc29vbjrC oCBjYW4gYW55b25lIHNlZSB3aGF0JiMzOTtzIHdyb25nIHdpdGggdGhpcyBmdW5jdGlvbj88YnI+ PGJyPjwvZGl2PlRoZSByZXN1bHRzIGFyZSBnZW5lcmF0ZWQgcGVyZmVjdGx5IHdlbGwsIGJ1dCB0 aGUgcmV0dXJuIHZhbHVlIG9mIGh0ZSBmdW5jdGlvbiBpcyA8YnI+PGJyPltjbC1zdHJ1Y3QtZGVm ZXJyZWQgZGVmZXJyZWQ6ZGVmYXVsdC1jYWxsYmFjayBkZWZlcnJlZDpkZWZhdWx0LWVycm9yYmFj ayBkZWZlcnJlZDpkZWZhdWx0LWNhbmNlbCBuaWwgbmlsIG5pbF0gWzIgdGltZXNdPGJyPjxicj48 Y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