emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jambunathan K <kjambunathan@gmail.com>
To: Erik Hetzner <egh@e6h.org>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: zotero plain, org-odt, and citations in general
Date: Sat, 12 Nov 2011 02:43:12 +0530	[thread overview]
Message-ID: <81fwhu2wif.fsf@gmail.com> (raw)
In-Reply-To: <87k477hnqy.wl%egh@e6h.org> (Erik Hetzner's message of "Thu, 10 Nov 2011 09:48:53 -0800")


Erik

>> Footnotes: 
>> 
>> [1]  With Mozrepl 1.1 beta2 on Firefox 3.6.23, I am unable to make
>> org-zotero.el work. It hangs and I have to C-g out (Christian! you are
>> not alone). I am able to get as far as creating the LIBRARY_KEY for the
>> selected item in the zotero pane and not further.
>>
>> […]
>
> Have you started MozRepl from Firefox? I re-installed mozrepl, checked
> that I am using the latest (and unmodified) versions of moz.el and
> zotero-plain. Everything seems fine. This is with Emacs 23 - perhaps
> Emacs 24 changes things?

Here is what I find:

If I put the below snippet in a javascript buffer and do a M-x
send-region, I am able to retrieve the library and key of the selected
item.


#+begin_src javascript
repl.whereAmI()

var ZoteroPane = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow("navigator:browser").ZoteroPane;
var selected_items = ZoteroPane.getSelectedItems();
new String(selected_items.length);
selected_items[0].libraryID;
selected_items[0].key;
#+end_src

Here is transaction log:

,---- From *MozRepl*
| 
| Welcome to MozRepl.
| 
|  - If you get stuck at the "...>" prompt, enter a semicolon (;) at the beginning of the line to force evaluation.
|  - If you get errors after every character you type, see http://github.com/bard/mozrepl/wikis/troubleshooting (short version: stop using Microsoft telnet, use netcat or putty instead)
| 
| Current working context: chrome://browser/content/browser.xul
| Current input mode: syntax
| 
| repl> [object ChromeWindow] - Document title: "fbennett / citeproc-js / source  Bitbucket - Mozilla Firefox"
| 1 — {0: "1"}
| 
| repl> 579241
| 
| repl> "TPSFKWXK"
| 
| repl> 
`----

The problem is in zotero-js-write-to-file. The problem happens even
after I increase the sleep out time to 1 sec.

See the attached backtrace with With M-x toggle-debug-on-quit RET and a
C-g

I wonder whether the issue is related to we - Matt(?), Christian(?) and
I - using Windows.


As can be seen from the transaction log, the shell interaction is
fine. I am inclined to think that it has something to do with zotero.el.

I am wondering whether there is a way to "capture" the selected item as
a zotero link through the jsbridge interface. Anyways with massaging of
org-protocol we can get a zotero "select" link by viewing the "report"
of the current item.

Debugger entered--Lisp error: (quit)
  sleep-for(0 10)
  (while (not (file-exists-p tmp-file)) (sleep-for 0 10))
  (let ((tmp-file (make-temp-file "zotero"))) (delete-file tmp-file) (zotero-js-write-to-file tmp-file expr) (while (not (file-exists-p tmp-file)) (sleep-for 0 10)) (prog1 (save-excursion (with-temp-buffer (insert-file-contents tmp-file) (buffer-substring-no-properties (point-min) (point-max)))) (delete-file tmp-file)))
  zotero-js-get-string-value("new String(selected_items.length)")
  (error "%s" (zotero-js-get-string-value "new String(selected_items.length)"))
  zotero-get-selected-item-ids()
  (let ((ids (zotero-get-selected-item-ids))) (mapc (lambda (id) (insert (format "[[zotero://select//%s][%s]]\n" id id)) (org-zotero-update-reference-link-at-point) (forward-line 1)) ids))
  org-zotero-insert-reference-link()
  call-interactively(org-zotero-insert-reference-link t nil)
  execute-extended-command(nil)
  call-interactively(execute-extended-command nil nil)
  recursive-edit()

  debug(error (quit))
  sleep-for(1 10)
  (while (not (file-exists-p tmp-file)) (sleep-for 1 10))
  (let ((tmp-file (make-temp-file "zotero"))) (delete-file tmp-file) (zotero-js-write-to-file tmp-file expr) (while (not (file-exists-p tmp-file)) (sleep-for 1 10)) (prog1 (save-excursion (with-temp-buffer (insert-file-contents tmp-file) (buffer-substring-no-properties (point-min) (point-max)))) (delete-file tmp-file)))
  zotero-js-get-string-value("new String(selected_items.length)")
  (error "%s" (zotero-js-get-string-value "new String(selected_items.length)"))
  zotero-get-selected-item-ids()
  (let ((ids (zotero-get-selected-item-ids))) (mapc (lambda (id) (insert (format "[[zotero://select//%s][%s]]\n" id id)) (org-zotero-update-reference-link-at-point) (forward-line 1)) ids))
  org-zotero-insert-reference-link()
  call-interactively(org-zotero-insert-reference-link t nil)
  execute-extended-command(nil)
  call-interactively(execute-extended-command nil nil)

-- 

  parent reply	other threads:[~2011-11-11 21:13 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-09  2:06 zotero plain, org-odt, and citations in general Matt Price
2011-11-09  5:26 ` Jambunathan K
2011-11-10 15:17   ` Jambunathan K
2011-11-10 15:50     ` Thomas S. Dye
2011-11-10 17:48     ` Erik Hetzner
2011-11-11 15:51       ` Matt Price
2011-11-11 16:12         ` Erik Hetzner
2011-11-11 18:45           ` Matt Price
2011-11-12  0:07             ` Erik Hetzner
2011-11-12 23:45           ` Christian Moe
2011-11-12 23:46             ` Christian Moe
2011-11-11 20:34       ` zotero-cite (A Proposal) Jambunathan K
2011-11-14 15:38         ` Matt Price
2011-11-16  5:25         ` Erik Hetzner
2011-11-11 21:13       ` Jambunathan K [this message]
2011-11-12  7:21         ` zotero plain, org-odt, and citations in general Christian Moe
2011-11-12 14:20           ` Matt Price
2011-11-16  5:30         ` Erik Hetzner
2011-11-09  7:03 ` Erik Hetzner
2011-11-09  7:25   ` Jambunathan K
2011-11-09 14:13     ` Ken Williams
2011-11-09 19:39       ` Christian Moe
2011-11-10  4:53         ` Erik Hetzner
2011-11-10  9:01           ` Christian Moe
2011-11-11 15:37         ` Matt Price
2011-11-11 17:51           ` Erik Hetzner
2011-11-11 18:34             ` Matt Price
2011-11-09 15:28     ` Matt Price
2011-11-10  4:40       ` Erik Hetzner
2011-11-13 22:47 ` Christian Moe
2011-11-14 15:38   ` Matt Price

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=81fwhu2wif.fsf@gmail.com \
    --to=kjambunathan@gmail.com \
    --cc=egh@e6h.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).