blefloch / latex-unravel

Watching TeX digest tokens
25 stars 1 forks source link

Error: The variable \l__unravel_prev_action_tl has not been declared #63

Open muzimuzhi opened 7 months ago

muzimuzhi commented 7 months ago
\documentclass{article}
\usepackage{unravel}

\ExplSyntaxOn
\debug_on:n { check-declarations }
\ExplSyntaxOff

\unravel{\chardef\mychar=1\relax}
%% caught when unraveling \bool_const:Nn
% \ExplSyntaxOn
% \unravel { \bool_const:Nn \c_my_bool { \c_true_bool } }
% \ExplSyntaxOff

\begin{document}
\end{document}

As \l__unravel_prev_action_tl is only used in \__unravel_prefixed_new:nn { shorthand_def } { ... }, it seems to me this should be enough:

diff --git a/unravel.dtx b/unravel.dtx
index b603c25..a60ee48 100644
--- a/unravel.dtx
+++ b/unravel.dtx
@@ -7104,6 +7104,7 @@
 %    \end{macrocode}
 %
 %    \begin{macrocode}
+\tl_new:N \l_@@_prev_action_tl
 \@@_prefixed_new:nn { shorthand_def }                       % 95
   {
     \@@_prev_input_silent:V \l_@@_head_tl

But I have no idea weather there're more like this, and where to put the new test and in what form, thus I choose to open an issue instead of a PR.

muzimuzhi commented 7 months ago

Related code lines https://github.com/blefloch/latex-unravel/blob/2e437fbe777cd78261087a0bd0e5d1c1441ec35e/unravel.dtx#L2320-L2326 https://github.com/blefloch/latex-unravel/blob/2e437fbe777cd78261087a0bd0e5d1c1441ec35e/unravel.dtx#L7107-L7120

\l_@@_prev_action_tl is only found on lines 7110 and 7114.