From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jambunathan K Subject: Re: zotero plain, org-odt, and citations in general Date: Sat, 12 Nov 2011 02:43:12 +0530 Message-ID: <81fwhu2wif.fsf@gmail.com> References: <81hb2drhmu.fsf@gmail.com> <81mxc4ovlh.fsf@gmail.com> <87k477hnqy.wl%egh@e6h.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:54260) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROyPe-0007M2-VZ for emacs-orgmode@gnu.org; Fri, 11 Nov 2011 16:13:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ROyPd-0001TI-90 for emacs-orgmode@gnu.org; Fri, 11 Nov 2011 16:13:26 -0500 Received: from mail-yw0-f41.google.com ([209.85.213.41]:59002) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROyPc-0001T6-Vx for emacs-orgmode@gnu.org; Fri, 11 Nov 2011 16:13:25 -0500 Received: by ywp17 with SMTP id 17so1357282ywp.0 for ; Fri, 11 Nov 2011 13:13:24 -0800 (PST) In-Reply-To: <87k477hnqy.wl%egh@e6h.org> (Erik Hetzner's message of "Thu, 10 Nov 2011 09:48:53 -0800") 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: Erik Hetzner Cc: Org Mode Erik >> Footnotes:=20 >>=20 >> [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. >> >> [=E2=80=A6] > > 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 =3D Components.classes["@mozilla.org/appshell/window-mediato= r;1"].getService(Components.interfaces.nsIWindowMediator).getMostRecentWind= ow("navigator:browser").ZoteroPane; var selected_items =3D ZoteroPane.getSelectedItems(); new String(selected_items.length); selected_items[0].libraryID; selected_items[0].key; #+end_src Here is transaction log: ,---- From *MozRepl* |=20 | Welcome to MozRepl. |=20 | - If you get stuck at the "...>" prompt, enter a semicolon (;) at the be= ginning of the line to force evaluation. | - If you get errors after every character you type, see http://github.co= m/bard/mozrepl/wikis/troubleshooting (short version: stop using Microsoft t= elnet, use netcat or putty instead) |=20 | Current working context: chrome://browser/content/browser.xul | Current input mode: syntax |=20 | repl> [object ChromeWindow] - Document title: "fbennett / citeproc-js / s= ource Bitbucket - Mozilla Firefox" | 1 =E2=80=94 {0: "1"} |=20 | repl> 579241 |=20 | repl> "TPSFKWXK" |=20 | repl>=20 `---- 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) (zoter= o-js-write-to-file tmp-file expr) (while (not (file-exists-p tmp-file)) (sl= eep-for 0 10)) (prog1 (save-excursion (with-temp-buffer (insert-file-conten= ts tmp-file) (buffer-substring-no-properties (point-min) (point-max)))) (de= lete-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 (f= ormat "[[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) (zoter= o-js-write-to-file tmp-file expr) (while (not (file-exists-p tmp-file)) (sl= eep-for 1 10)) (prog1 (save-excursion (with-temp-buffer (insert-file-conten= ts tmp-file) (buffer-substring-no-properties (point-min) (point-max)))) (de= lete-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 (f= ormat "[[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) --=20