emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [sort-of OT] Help with "request" and "deferred"


From: Matt Price
Subject: [O] [sort-of OT] Help with "request" and "deferred"
Date: Wed, 28 Jan 2015 20:37:37 -0500

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:

"<div style=\"line-height: 1.35; padding-left: 2em; text-indent:-2em;\" class=\"csl-bib-body\">
  <div class=\"csl-entry\">Suchman, Lucy. “Subject Objects.” <i>Feminist Theory</i> 12, no. 2 (August 1, 2011): 119–45. http://resolver.scholarsportal.info/resolve/14647001/v12i0002/119_so.xml.</div>
  <span class=\"Z3988\" title=\"url_ver=Z39.88-2004&amp;ctx_ver=Z39.88-2004&amp;rfr_id=info%3Asid%2Fzotero.org%3A2&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=article&amp;rft.atitle=Subject%20objects&amp;rft.jtitle=Feminist%20Theory&amp;rft.volume=12&amp;rft.issue=2&amp;rft.aufirst=Lucy&amp;rft.aulast=Suchman&amp;rft.au=Lucy%20Suchman&amp;rft.date=2011-08-01&amp;rft.pages=119-145&amp;rft.spage=119&amp;rft.epage=145&amp;rft.issn=14647001\"></span>
</div>"


-------

(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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]