emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] zotero plain, org-odt, and citations in general


From: Jambunathan K
Subject: Re: [O] zotero plain, org-odt, and citations in general
Date: Sat, 12 Nov 2011 02:43:12 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (windows-nt)

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)

-- 



reply via email to

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