From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Jackson Subject: Re: Bug: reftex breaking after org-mode export [8.2.10 (8.2.10-35-g19a7d6-elpa @ /Users/adamjackson/.emacs.d/elpa/org-20150323/)] Date: Wed, 25 Mar 2015 13:58:09 +0000 Message-ID: <2B95BDE9-F4B3-4552-8202-E1B2E7E9FBC6@physics.org> References: <1EAD2758-E620-4D07-9622-16E636B2EBE0@physics.org> Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_F91A006D-69B6-4C0E-92E8-C2A60DBD44B9" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yalp2-000294-D6 for emacs-orgmode@gnu.org; Wed, 25 Mar 2015 09:58:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yaloz-0001Fn-IR for emacs-orgmode@gnu.org; Wed, 25 Mar 2015 09:58:16 -0400 Received: from mansell.bath.ac.uk ([138.38.0.35]:37251) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yaloz-0001FT-8c for emacs-orgmode@gnu.org; Wed, 25 Mar 2015 09:58:13 -0400 In-Reply-To: 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: John Kitchin Cc: emacs-orgmode@gnu.org --Apple-Mail=_F91A006D-69B6-4C0E-92E8-C2A60DBD44B9 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Thanks, John. org-ref looks quite handy, although I would like to try and get basic = functionality working without adding another package. Does it implement = cross-references independently of reftex? Perhaps I need to abandon = reftex, but this seems like it should be a trivial problem. Commenting out the org-ref block, this setup seems to work in that I am = able to insert citations with "M-x reftex-citation" after exporting to = LaTeX. This suggests that (reftex-parse-all) is somewhat to blame. = However, attempting to insert an equation reference with "M-x = reftex-reference" still fails after exporting and works before the first = export. I suspect TeX-master is indeed involved, as the backtrace = suggests. Returning to my original setup and commenting out the (reftex-parse-all) = gives a similar result to your block; working citations, but = cross-references that break after LaTeX export. One of the most baffling = aspects is that killing and re-opening the buffer and re-starting Reftex = does not eliminate the problem; I have to actually quit and re-open = emacs. Regards, Adam --=20 Adam Jackson a.j.jackson@bath.ac.uk Doctoral student: Integrated PhD Sustainable Chemical Technologies University of Bath On 25 Mar 2015, at 13:29, John Kitchin wrote: > If it is helpful, here is my setup in org-ref: >=20 > (require 'reftex) > (defun org-mode-reftex-setup () > "Setup `org-mode' and reftex for org-ref." > (and (buffer-file-name) > (file-exists-p (buffer-file-name)) > (global-auto-revert-mode t)) > (make-local-variable 'reftex-cite-format) > (setq reftex-cite-format 'org)) >=20 > ;; define key for inserting citations > (define-key org-mode-map > (kbd org-ref-insert-cite-key) > org-ref-insert-cite-function) >=20 > (add-hook 'org-mode-hook 'org-mode-reftex-setup) >=20 > (eval-after-load 'reftex-vars > '(progn > (add-to-list 'reftex-cite-format-builtin > '(org "Org-mode citation" > ((?\C-m . "cite:%l") ; default > (?d . ",%l") ; for appending > (?a . "autocite:%l") > (?t . "citet:%l") > (?T . "citet*:%l") > (?p . "citep:%l") > (?P . "citep*:%l") > (?h . "citeauthor:%l") > (?H . "citeauthor*:%l") > (?y . "citeyear:%l") > (?x . "citetext:%l") > (?n . "nocite:%l") > ))))) >=20 > I think you might be seeing something like a TeX-master problem. Did = you try > this without revtex-parse-all? >=20 > Adam Jackson writes: >=20 >> Hi, >>=20 >> I've been struggling with Reftex in org-mode. Initially things are = fine, >> then after exporting the document to LaTeX and continuing to work = with >> org-mode, using most of the reftex features (e.g. reftex-toc or = trying to >> insert a reference) produces a "Wrong type argument: stringp, nil" = error >> message. >>=20 >> The code in my init file to set up reftex: >>=20 >> ;; Reftex >> (require 'reftex) >> (defun org-mode-reftex-setup () >> (load-library "reftex") >> (and (buffer-file-name) (file-exists-p (buffer-file-name)) >> ;enable auto-revert-mode to update reftex when bibtex file = changes on disk >> (global-auto-revert-mode t) >> (reftex-parse-all) >> (define-key org-mode-map (kbd "C-c [") 'reftex-citation) >> ;add a custom reftex cite format to insert links >> ;; (reftex-set-cite-format "** [[papers:%l][%l]]: %t \n") >> ) >> ) >>=20 >> (add-hook 'org-mode-hook 'org-mode-reftex-setup) >>=20 >> At the moment I still enter reftex-mode on demand with "M-x = reftex-mode". >> Here is the backtrace for the error: >>=20 >> Debugger entered--Lisp error: (wrong-type-argument stringp nil) >> re-search-forward(nil 10001 t) >> tex-main-file() >> reftex-TeX-master-file() >> reftex-insert-docstruct(# t "e" nil nil t nil nil = ("SEC:lagrange_gibbs_proof" "s" "We define the molar Gibbs free energy = in a molecular gas mixture as \\begin{align} \\h" = "/my/path/to/the/paper.org" nil) "" nil) >> byte-code("\306 \307\216\310 \210 \311 \f\203=1F >=20 > -- > Professor John Kitchin > Doherty Hall A207F > Department of Chemical Engineering > Carnegie Mellon University > Pittsburgh, PA 15213 > 412-268-7803 > @johnkitchin > http://kitchingroup.cheme.cmu.edu --Apple-Mail=_F91A006D-69B6-4C0E-92E8-C2A60DBD44B9 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii

Returning to my original setup and = commenting out the (reftex-parse-all) gives a similar result to your = block; working citations, but cross-references that break after LaTeX = export. One of the most baffling aspects is that killing and re-opening = the buffer and re-starting Reftex does not eliminate the problem; I have = to actually quit and re-open = emacs.

Regards,
Adam

a.j.jackson@bath.ac.uk
Docto= ral student: Integrated PhD Sustainable Chemical = Technologies
jkitchin@andrew.cmu.edu> = wrote:

If it is helpful, here is my setup in = org-ref:

(require 'reftex)
(defun org-mode-reftex-setup ()
=  "Setup `org-mode' and reftex for org-ref."
=    (and (buffer-file-name)
=         (file-exists-p = (buffer-file-name))
=         (global-auto-revert-mode = t))
   (make-local-variable 'reftex-cite-format)
=    (setq reftex-cite-format 'org))

;; define key = for inserting citations
(define-key org-mode-map
 (kbd = org-ref-insert-cite-key)
=  org-ref-insert-cite-function)

(add-hook 'org-mode-hook = 'org-mode-reftex-setup)

(eval-after-load 'reftex-vars
=  '(progn
     (add-to-list = 'reftex-cite-format-builtin
=             &n= bsp;     '(org "Org-mode citation"
=             &n= bsp;           ((?\= C-m . "cite:%l")     ; default
=             &n= bsp;           &nbs= p;(?d . ",%l") =            ; for = appending
=             &n= bsp;           &nbs= p;(?a . "autocite:%l")
=             &n= bsp;           &nbs= p;(?t . "citet:%l")
=             &n= bsp;           &nbs= p;(?T . "citet*:%l")
=             &n= bsp;           &nbs= p;(?p . "citep:%l")
=             &n= bsp;           &nbs= p;(?P . "citep*:%l")
=             &n= bsp;           &nbs= p;(?h . "citeauthor:%l")
=             &n= bsp;           &nbs= p;(?H . "citeauthor*:%l")
=             &n= bsp;           &nbs= p;(?y . "citeyear:%l")
=             &n= bsp;           &nbs= p;(?x . "citetext:%l")
=             &n= bsp;           &nbs= p;(?n . "nocite:%l")
=             &n= bsp;           &nbs= p;)))))

I think you might be seeing something like a TeX-master = problem. Did you try
this without revtex-parse-all?

Adam = Jackson writes:

Hi,

I've been = struggling with Reftex in org-mode. Initially things are fine,
then = after exporting the document to LaTeX and continuing to work = with
org-mode, using most of the reftex features (e.g. reftex-toc or = trying to
insert a reference) produces a "Wrong type argument: = stringp, nil" error
message.

The code in my init file to set = up reftex:

   ;; Reftex
=    (require 'reftex)
   (defun = org-mode-reftex-setup ()
     (load-library = "reftex")
     (and (buffer-file-name) = (file-exists-p (buffer-file-name))
=         ;enable auto-revert-mode = to update reftex when bibtex file changes on disk
=         (global-auto-revert-mode = t)
=         (reftex-parse-all)
=          (define-key = org-mode-map (kbd "C-c [") 'reftex-citation)
=         ;add a custom reftex = cite format to insert links
=         ;; = (reftex-set-cite-format "** [[papers:%l][%l]]: %t \n")
=         )
=    )

   (add-hook 'org-mode-hook = 'org-mode-reftex-setup)

At the moment I still enter reftex-mode = on demand with "M-x reftex-mode".
Here is the backtrace for the = error:

Debugger entered--Lisp error: (wrong-type-argument stringp = nil)
 re-search-forward(nil 10001 t)
=  tex-main-file()
 reftex-TeX-master-file()
=  reftex-insert-docstruct(#<buffer paper.org> t "e" nil nil t nil nil = ("SEC:lagrange_gibbs_proof" "s" "We define the molar Gibbs free energy = in a molecular gas mixture as \\begin{align} \\h" "/my/path/to/the/paper.org" nil) "" nil)
=  byte-code("\306 \307\216\310 \210 \311 = \f\203=1F

--
Professor John Kitchin
Doherty = Hall A207F
Department of Chemical Engineering
Carnegie Mellon = University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.e= du

= --Apple-Mail=_F91A006D-69B6-4C0E-92E8-C2A60DBD44B9--