Nick Dokos <[email protected]> writes:
> Kaushal Modi <[email protected]> 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