emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [sort-of OT] Help with "request" and "deferred"
@ 2015-01-29  1:37 Matt Price
  0 siblings, 0 replies; only message in thread
From: Matt Price @ 2015-01-29  1:37 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 2514 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 3560 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-01-29  1:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-29  1:37 [sort-of OT] Help with "request" and "deferred" Matt Price

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).