emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: reftex breaking after org-mode export [8.2.10 (8.2.10-35-g19a7d6-elpa @ /Users/adamjackson/.emacs.d/elpa/org-20150323/)]
@ 2015-03-23 11:58 Adam Jackson
  2015-03-25 13:29 ` John Kitchin
  0 siblings, 1 reply; 4+ messages in thread
From: Adam Jackson @ 2015-03-23 11:58 UTC (permalink / raw)
  To: emacs-orgmode

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

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 \x18\307\216\310 \210	\x12\311 \x13\f\203\x1f\0\312r	q\210\313
!)!\210\202&\0\312\314!\210\315 \210\x0e@\316=\2040\0\316 \210\317\320p\"\210\321\x16A\322\323\324\325\326\x0eB\327\330\331\332\333\257\v\x16C\334 \335U\203v\0\336\x1eD\337\340!\210\341	\x0eE
\336\x0eF\x0eG\x0eH\x0eI\x0eJ\206k\0\x0eK\x0eL\336&\v\x16K)\202\211\0\x0eJ\203\206\0\342	\x0eJ
#\x16K\202\211\0\321\x16K\321\x16D\x0eK\206\222\0\321\x16K\336\x16J\343\x0eM\x0eN\x0eO\x0eK\344\x0eP&\x06\211\x16Q@\x16R\x0eQA@\x16S\345\x0eQ8\x16T\321\x16K\x0eR\204\304\0\346\347\336\"\210\x0eR\350=\203\321\0\315 \210\202 \x02\x0eR\351=\204\337\0\x0eR\352=\203\365\0\x0eU\203\347\0\352\x16R\315 \210\353	\x0eT\x0eR#\210\202 \x02\x0eR\354=\203\a\x01\315 \210\x0eG?\x16G\202 \x02\x0eR\355=\203\x18\x01\x0eV\x16J\356 \x15\202 \x02\x0eR\357=\2038\x01\315 \210\x0eU\2030\x01\360\x0eU!\x16W\202 \x02\x0eE?\x16E\202 \x02\x0eR\361=\203J\x01\315 \210\x0eF?\x16F\202 \x02\x0eR\362=\203\\\x01\315 \210\x0eH?\x16H\202 \x02\x0eR\363=\203n\x01\315 \210\x0eI?\x16I\202 \x02\x0eR\364=\203\201\x01\x0eX\x16Y\346\347\321\"\210\202 \x02\x0eR\365=\203\264\x01\366\x0eZ\x0e[\"\x16[\367\x0e[\x0eZ8A!\206\236\x01\370\371!\x11\x0e[\x0eZ8@\206\251\x01\372\x16L	q\210\373 \210\202 \x02\x0eR;\203\324\x01\374\x0eR\x0e\\J\"\206\310\x01\x0eR
DCC\x16Y\346\347\321\"\210\202 \x02\x0eR\375>\203\x1a\x02\x0e]\203\350\x01\x0e]\237\x16Y\202\371\x01\x0eS\203\366\x01\x0eSCC\x16Y\202\371\x01\336\x16Y\x0eY\203\x0f\x02\x0eR\376\232\203\v\x02\377\x0eYB\x16Y\x0eY\x16X	q\210\346\347\321\"\210\202 \x02\370\201^\0!\210*\202\0\0" [wconfig buf reftex-call-back-to-this-buffer reftex-latex-syntax-table reftex-use-multiple-selection-buffers typekey current-window-configuration ((set-window-configuration wconfig)) delete-other-windows syntax-table switch-to-buffer-other-window reftex-make-selection-buffer-name "*RefTeX Select*" reftex-erase-buffer reftex-select-label-mode add-to-list selection-buffers t "----  " mode-line-buffer-identification "  " global-mode-string "   (" ")" "  S<" reftex-refstyle ">" " -%-" buffer-size 0 nil message "Creating Selection Buffer..." reftex-insert-docstruct reftex-get-offset reftex-select-item reftex-show-label-location 2 throw exit 103 114 82 reftex-reparse-document 99 115 reftex-query-label-type 116 prefix-numeric-value 70 ...] 13)
  reftex-offer-label-menu("e")
  reftex-reference()
  call-interactively(reftex-reference nil nil)

Many thanks,
Adam



Emacs  : GNU Emacs 24.3.1 (x86_64-apple-darwin, NS apple-appkit-1038.36)
 of 2013-03-13 on bob.porkrind.org
Package: Org-mode version 8.2.10 (8.2.10-35-g19a7d6-elpa @ /Users/adamjackson/.emacs.d/elpa/org-20150323/)

current state:
==============
(setq
 org-export-backends '(latex md ascii html icalendar beamer)
 org-tab-first-hook '(org-hide-block-toggle-maybe org-src-native-tab-command-maybe
                      org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
 org-latex-classes '(("beamer" "\\documentclass[presentation]{beamer}" ("\\section{%s}" . "\\section*{%s}")
                      ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
                     ("article" "\\documentclass[11pt]{article}" ("\\section{%s}" . "\\section*{%s}")
                      ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
                      ("\\paragraph{%s}" . "\\paragraph*{%s}") ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
                     ("report" "\\documentclass[11pt]{report}" ("\\part{%s}" . "\\part*{%s}")
                      ("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . "\\section*{%s}")
                      ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
                     ("book" "\\documentclass[11pt]{book}" ("\\part{%s}" . "\\part*{%s}")
                      ("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . "\\section*{%s}")
                      ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
                     )
 org-speed-command-hook '(org-speed-command-default-hook org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-html-format-drawer-function '(lambda (name contents) contents)
 org-log-done 'time
 org-latex-format-inlinetask-function 'ignore
 org-confirm-shell-link-function 'yes-or-no-p
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-agenda-custom-commands '(("h" "\"home\": Agenda and unscheduled non-work TODOs"
                               ((agenda "" nil) (tags-todo "-work-SCHEDULED={.+}" nil)) nil nil)
                              ("H" "\"Home\": Non-work unscheduled TODOs" tags "-work-SCHEDULED={.+}" nil)
                              ("w" "Unscheduled :work:" tags "work-SCHEDULED={.+}" nil)
                              ("n" "Agenda and all TODOs" ((agenda "" nil) (alltodo "" nil)) nil))
 org-latex-format-headline-function 'org-latex-format-headline-default-function
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-latex-format-drawer-function '(lambda (name contents) contents)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-agenda-dim-blocked-tasks 'invisible
 org-mode-hook '((lambda nil
                  (org-add-hook (quote change-major-mode-hook) (quote org-show-block-all) (quote append)
                   (quote local))
                  )
                 (lambda nil
                  (org-add-hook (quote change-major-mode-hook) (quote org-babel-show-result-all) (quote append)
                   (quote local))
                  )
                 #[nil "\300\301\302\303\304$\207"
                   [org-add-hook change-major-mode-hook org-show-block-all append local] 5]
                 #[nil "\300\301\302\303\304$\207"
                   [org-add-hook change-major-mode-hook org-babel-show-result-all append local] 5]
                 org-babel-result-hide-spec org-babel-hide-all-hashes org-mode-reftex-setup)
 org-ascii-format-drawer-function '(lambda (name contents width) contents)
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point org-babel-execute-safely-maybe)
 org-directory "~/Dropbox/org"
 org-enforce-todo-dependencies t
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers org-cycle-hide-inline-tasks
                  org-cycle-show-empty-lines org-optimize-window-after-visibility-change)
 org-babel-tangle-lang-exts '(("python" . "py") ("emacs-lisp" . "el"))
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-blocker-hook '(org-block-todo-from-children-or-siblings-or-parent)
 org-html-format-headline-function 'ignore
 org-babel-load-languages '((python . t))
 org-html-format-inlinetask-function 'ignore
 org-agenda-files '("~/Dropbox/org/todo.org" "~/Dropbox/org/shopping.org")
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 )




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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug: reftex breaking after org-mode export [8.2.10 (8.2.10-35-g19a7d6-elpa @ /Users/adamjackson/.emacs.d/elpa/org-20150323/)]
  2015-03-23 11:58 Bug: reftex breaking after org-mode export [8.2.10 (8.2.10-35-g19a7d6-elpa @ /Users/adamjackson/.emacs.d/elpa/org-20150323/)] Adam Jackson
@ 2015-03-25 13:29 ` John Kitchin
  2015-03-25 13:58   ` Adam Jackson
  0 siblings, 1 reply; 4+ messages in thread
From: John Kitchin @ 2015-03-25 13:29 UTC (permalink / raw)
  To: Adam Jackson; +Cc: emacs-orgmode

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
                   '(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")
                          )))))

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\x1f

--
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug: reftex breaking after org-mode export [8.2.10 (8.2.10-35-g19a7d6-elpa @ /Users/adamjackson/.emacs.d/elpa/org-20150323/)]
  2015-03-25 13:29 ` John Kitchin
@ 2015-03-25 13:58   ` Adam Jackson
  2015-03-25 15:38     ` John Kitchin
  0 siblings, 1 reply; 4+ messages in thread
From: Adam Jackson @ 2015-03-25 13:58 UTC (permalink / raw)
  To: John Kitchin; +Cc: emacs-orgmode

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

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

-- 
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 <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
>                   '(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")
>                          )))))
> 
> 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\x1f
> 
> --
> 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


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug: reftex breaking after org-mode export [8.2.10 (8.2.10-35-g19a7d6-elpa @ /Users/adamjackson/.emacs.d/elpa/org-20150323/)]
  2015-03-25 13:58   ` Adam Jackson
@ 2015-03-25 15:38     ` John Kitchin
  0 siblings, 0 replies; 4+ messages in thread
From: John Kitchin @ 2015-03-25 15:38 UTC (permalink / raw)
  To: Adam Jackson; +Cc: emacs-orgmode

If by cross-references you mean \ref and \label, those are implemented
independently of reftex as new org-mode links, e.g. label:some-key and
ref:some-key. There are a variety of completion options to make
inserting these pretty easy. you can use reftex to insert citations in
org-ref, but the default is now to use helm-bibtex which I find easer to
search in, in addition to providing a lot more functionality for
interacting with bibliography entries.

Adam Jackson writes:

> 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

--
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-03-25 15:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-23 11:58 Bug: reftex breaking after org-mode export [8.2.10 (8.2.10-35-g19a7d6-elpa @ /Users/adamjackson/.emacs.d/elpa/org-20150323/)] Adam Jackson
2015-03-25 13:29 ` John Kitchin
2015-03-25 13:58   ` Adam Jackson
2015-03-25 15:38     ` John Kitchin

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).