[O] org-mode git master. ox-latex export errors out due to a table
Hi, I updated my copy of org-mode from git master after about 2-3 weeks. The ox-latex export used to work fine but now it is failing due to something in the tables I have in my .org files. If I comment out those tables, the ox-latex export works fine. Else it errors out due to (void-function nil) error. Here is one of such tables. The below is a MWE which can reproduce the error I am seeing. The error occurs when I do "C-c C-e l l" = MWE = * Severity #+CAPTION: Macros for reporting messages of different severities #+NAME: tab__uvm_reporting_macros |--+--+---| | Severity | Macro| Default Verbosity | |--+--+---| | Info | =`uvm_info("ID", "Message", UVM_MEDIUM)= | No default| | Warning | =`uvm_warning("ID", "Message")= | =UVM_NONE=| | Error| =`uvm_error("ID", "Message")=| =UVM_NONE=| | Fatal| =`uvm_fatal("ID", "Message")= [fn:1] | =UVM_NONE=| |--+--+---| * Footnotes [fn:1] Simulation is quit when this macro is called = Backtrace = Debugger entered--Lisp error: (void-function nil) nil(((paragraph (:begin 740 :end 785 :contents-begin 740 :contents-end 785 :post-blank 0 :post-affiliated 740 :parent (footnote-definition (:label "fn:1" :begin 733 :end 785 :contents-begin 740 :contents-end 785 :post-blank 0 :post-affiliated 733 :parent (section (:begin 733 :end 785 :contents-begin 733 :contents-end 785 :post-blank 0 :post-affiliated 733 :parent (headline ... #5)) #3)) #1)) #("Simulation is quit when this macro is called\n" 0 45 (:parent #1) #[257 "\303 \300\"\2050 \301 \301\242B\240\210\304 \211;\203 \305\306 #\202# \307 A@ \"\266\202\310=\2050 \302\311 \300\"!\207" [(:export-options nil :input-buffer "ox-latex-table-export-error.org" :input-file "/home/kmodi/sandbox/org/ox-latex-table-export-error.org" :latex-class "article" :latex-class-options nil :latex-header nil :latex-header-extra nil :description nil :keywords nil :subtitle nil :latex-active-timestamp-format "\\textit{%s}" :latex-caption-above (table) :latex-classes (("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}"))) :latex-default-figure-position "H" :latex-default-table-environment "tabular" :latex-default-table-mode table :latex-diary-timestamp-format "\\textit{%s}" :latex-footnote-separator "\\textsuperscript{,}\\," :latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"] :latex-format-headline-function org-latex-format-headline-default-function :latex-format-inlinetask-function org-latex-format-inlinetask-default-function :latex-hyperref-template "\\hypersetup{\n pdfauthor={%a},\n pdftitle={%t},\n pdfkeywords={%k},\n pdfsubject={%d},\n pdfcreator={%c}, \n pdflang={%L}}\n" :latex-image-default-height "" :latex-image-default-option "" :latex-image-default-width ".9\\linewidth" ...) (((footnote-reference (:label "fn:1" :type standard :begin 610 :end 616 :contents-begin nil :contents-end nil :post-blank 0 :parent (table-cell (:begin 579 :end 622 :contents-begin 580 :contents-end 616 :post-blank 0 :parent ...) (verbatim ...) #4) nil org-export-footnote-first-reference-p :type get-text-property 0 plist-get standard org-export-get-footnote-definition] 7 "\n\n(fn REF)"]((footnote-reference (:label "fn:1" :type standard :begin 610 :end 616 :contents-begin nil :contents-end nil :post-blank 0 :parent (table-cell (:begin 579 :end 622 :contents-begin 580 :contents-end 616 :post-blank 0 :parent (table-row (:type standard :begin 567 :end 643 :contents-begin 568 :contents-end 642 :post-blank 0 :post-affiliated 567 :parent (table (:begin 12 :end 719 :type org :tblfm nil :contents-begin 111 :contents-end 719 :value nil :post-blank 0 :post-affiliated 111 :caption ... :name "tab__uvm_reporting_macros" :parent ...) (table-row ...) (table-row ... ... ... ...) (table-row ...) (table-row ... ... ... ...) (table-row ... ... ... ...) (table-row ... ... ... ...) #4 (table-row ...))) (table-cell (:begin 568 :end 579 :contents-begin 569 :contents-end 574 :post-blank 0 :parent #4) #("Fatal" 0 5 (:parent #5))) #2 (table-cell (:begin 622 :end 642 :contents-begin
Re: [O] org-mode git master. ox-latex export errors out due to a table
Thank you for providing the backtrace, but ... You knew there was a "but" coming, right? :-) Although some people can make sense of a backtrace produced with compiled code, it is far more useful to provide a backtrace produced with *uncompiled* code. What you have to do is C-u M-x org-reload RET and *then* produce the backtrace. If you want to go back to compiled code afterwards, do the M-x org-reload without the C-u. See (info "(org) Feedback") particularly the section entitled "How to create a useful backtrace". Also, please always provide the org-mode version: C-u M-x org-version FWIW, I can export your sample to PDF with no problems. I'm on Org-mode version 8.3.2 (release_8.3.2-178-g96681f) -- Nick
Re: [O] org-mode git master. ox-latex export errors out due to a table
> Although some people can make sense of a backtrace produced with compiled code, it is far more useful to provide a backtrace produced with *uncompiled* code. Apologies, I was unaware of that. I should have read that Info node first. Below is a gist link to the full backtrace with uncompiled code. https://gist.github.com/kaushalmodi/b76de1274b7a7bfe6020 Here's more info about this issue I am facing: - I cannot reproduce this error in emacs -Q with the same git version of org-mode in load-path. - But I can reproduce this error consistently even if I "delete/move" my ~/.emacs.d/init.el and ~/.emacs.d/elpa. I do not have a ~/.emacs file. While this step should be equivalent to emacs -Q, it doesn't seem to work that way for me. Even the load-path var is exact same as with emacs -Q (I install org-mode in the share/emacs dir). While I resolve the mystery of why removing the init.el is not the same as emacs -Q for me, I hope that the backtrace from uncompiled code can help point the problem in my emacs setup. Many thanks!
Re: [O] org-mode git master. ox-latex export errors out due to a table
Also, I am on the latest org-mode and emacs builds: org-mode version: Org-mode version 8.3.2 (release_8.3.2-251-g4ca117 @ /home/kmodi/usr_local/apps/6/emacs/master/share/emacs/site-lisp/org/) emacs-version: http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=5401bb8645f955b6fde8c0a5e5c8cf5ec1cab626
Re: [O] org-mode git master. ox-latex export errors out due to a table
Some more info: I cannot recreate this error when using - my emacs config - the same emacs build from git - BUT the latest org-plus-contrib from org elpa: Org-mode version 8.3.2 (8.3.2-10-g00dacd-elpaplus @ /home/kmodi/.emacs.d/elpa_25_0/org-plus-contrib-20151005/) So it is some change between: - 8.3.2-10-g00dacd-elpaplus, and - release_8.3.2-251-g4ca117 Now I just need to decode what "g4ca117" means in that version that does not work for me. It doesn't seem to be any part of the git hash for the commit I am on ( http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=8bccb2131374bba8c82c2774abb34af488826ce4 )
Re: [O] org-mode git master. ox-latex export errors out due to a table
Kaushal Modiwrites: >> Although some people can make sense of a backtrace produced with > compiled code, it is far more useful to provide a backtrace produced > with *uncompiled* code. > > Apologies, I was unaware of that. I should have read that Info node first. > Below is a gist link to the full backtrace with uncompiled code. > > https://gist.github.com/kaushalmodi/b76de1274b7a7bfe6020 > I can reproduce it with the latest version too. It may have something to do with the recent conversion of ox-latex to lexical binding: I see closures all over the backtrace. > Here's more info about this issue I am facing: > - I cannot reproduce this error in emacs -Q with the same git version of > org-mode in load-path. > - But I can reproduce this error consistently even if I "delete/move" my > ~/.emacs.d/init.el and ~ > /.emacs.d/elpa. I do not have a ~/.emacs file. While this step should be > equivalent to emacs -Q, it > doesn't seem to work that way for me. Even the load-path var is exact same as > with emacs -Q (I install > org-mode in the share/emacs dir). > > While I resolve the mystery of why removing the init.el is not the same as > emacs -Q for me, I hope that > the backtrace from uncompiled code can help point the problem in my emacs > setup. > > Many thanks! -- Nick
Re: [O] org-mode git master. ox-latex export errors out due to a table
Kaushal Modiwrites: > Some more info: > > I cannot recreate this error when using > - my emacs config > - the same emacs build from git > - BUT the latest org-plus-contrib from org elpa: Org-mode version 8.3.2 > (8.3.2-10-g00dacd-elpaplus @ / > home/kmodi/.emacs.d/elpa_25_0/org-plus-contrib-20151005/) > > So it is some change between: > - 8.3.2-10-g00dacd-elpaplus, and > - release_8.3.2-251-g4ca117 > My guess is that it's this commit: commit 8bccb2131374bba8c82c2774abb34af488826ce4 Author: Nicolas Goaziou Date: Thu Oct 29 19:03:52 2015 +0100 ox-latex: Use lexical binding but I haven't reverted it yet to check. > Now I just need to decode what "g4ca117" means in that version that does not > work for me. It doesn't > seem to be any part of the git hash for the commit I am on ( > http://orgmode.org/cgit.cgi/org-mode.git/ > commit/?id=8bccb2131374bba8c82c2774abb34af488826ce4 ) The "g" stands for "git" and it's not part of the SHA1: 4ca117 are the first six digits of the SHA1 at the HEAD of the branch: commit 4ca1179c9e9c707267ac3738cc7c8442001b204b Author: Nicolas Goaziou Date: Sun Nov 1 00:58:57 2015 +0100 ox-odt: Use lexical binding -- Nick
Re: [O] org-mode git master. ox-latex export errors out due to a table
> The "g" stands for "git" and it's not part of the SHA1: 4ca117 are the first six digits of the SHA1 at the HEAD of the branch Ah, now that you spell it out, it's obvious. I swear I kept staring at the git hash to find the "117" in "g4ca117" in http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=4ca1179c9e9c707267ac3738cc7c8442001b204b but I never saw it! Now it stands out clear. And of course, I should have realized that "g" can never be part of the hex hash. Thanks, and also thanks for confirming that you see this error too.
Re: [O] org-mode git master. ox-latex export errors out due to a table
Kaushal Modiwrites: > @Nick Dokos Are you are on a commit before or after this lexical binding > change? http://orgmode.org/ > cgit.cgi/org-mode.git/commit/?id=8bccb2131374bba8c82c2774abb34af488826ce4 > > The failure symtoms in my backtrace look like they could be related to this > change. I think that is right. The problem seems to be with the search-refs function defined in the let* in org-latex--delayed-footnotes-definitions and passed down to org-element-map which tries to find it in the lexical environment and fails. -- Nick
Re: [O] org-mode git master. ox-latex export errors out due to a table
@Nick Dokos Are you are on a commit before or after this lexical binding change? http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=8bccb2131374bba8c82c2774abb34af488826ce4 The failure symtoms in my backtrace look like they could be related to this change.
Re: [O] org-mode git master. ox-latex export errors out due to a table
Nick Dokoswrites: > Kaushal Modi writes: > >> @Nick Dokos Are you are on a commit before or after this lexical binding >> change? http://orgmode.org/ >> cgit.cgi/org-mode.git/commit/?id=8bccb2131374bba8c82c2774abb34af488826ce4 >> >> The failure symtoms in my backtrace look like they could be related to this >> change. > > I think that is right. > > The problem seems to be with the search-refs function defined in the > let* in org-latex--delayed-footnotes-definitions and passed down to > org-element-map which tries to find it in the lexical environment and > fails. > Brute-forcing search-refs to be a special variable (i.e. dynamically, rather than lexically, bound) seems to fix the error, although I doubt it's the ultimate solution: --8<---cut here---start->8--- diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 060f423..3279be7 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -1459,6 +1459,8 @@ INFO is a plist used as a communication channel. See ;; Else use format string. (t (format fmt text) +(defvar search-refs) ; For byte-compiler. + (defun org-latex--delayed-footnotes-definitions (element info) "Return footnotes definitions in ELEMENT as a string. @@ -1481,7 +1483,6 @@ just outside of it." (org-export-get-footnote-definition ref info) info ;; Find every footnote reference in ELEMENT. (let* (all-refs - search-refs ; For byte-compiler. (search-refs (function (lambda (data) --8<---cut here---end--->8--- -- Nick
Re: [O] org-mode git master. ox-latex export errors out due to a table
Hello, Nick Dokoswrites: > Kaushal Modi writes: > >> @Nick Dokos Are you are on a commit before or after this lexical binding >> change? http://orgmode.org/ >> cgit.cgi/org-mode.git/commit/?id=8bccb2131374bba8c82c2774abb34af488826ce4 >> >> The failure symtoms in my backtrace look like they could be related to this >> change. > > I think that is right. > > The problem seems to be with the search-refs function defined in the > let* in org-latex--delayed-footnotes-definitions and passed down to > org-element-map which tries to find it in the lexical environment and > fails. Fixed. Thank you. Regards, -- Nicolas Goaziou
Re: [O] org-mode git master. ox-latex export errors out due to a table
Thanks Nick. That patch resolves the issue for now. At least, all my pdf exports are working fine as before.
Re: [O] org-mode git master. ox-latex export errors out due to a table
Thanks to you both for the quick solution and the upstream fix.