[latex3-commits] [git/LaTeX3-latex3-latex2e] hotfix/gh441: Use own (g)set and (g)put functions to avoid \debug_suspend: mess (40231e06)

PhelypeOleinik phelype.oleinik at latex-project.org
Fri Dec 18 01:08:42 CET 2020


Repository : https://github.com/latex3/latex2e
On branch  : hotfix/gh441
Link       : https://github.com/latex3/latex2e/commit/40231e060dcda4545b0650df2675cd33d61b33c6

>---------------------------------------------------------------

commit 40231e060dcda4545b0650df2675cd33d61b33c6
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date:   Thu Dec 17 21:08:42 2020 -0300

    Use own (g)set and (g)put functions to avoid \debug_suspend: mess


>---------------------------------------------------------------

40231e060dcda4545b0650df2675cd33d61b33c6
 base/lthooks.dtx | 87 +++++++++++++++++++++++++++++++-------------------------
 1 file changed, 48 insertions(+), 39 deletions(-)

diff --git a/base/lthooks.dtx b/base/lthooks.dtx
index 6abc0b8b..e6f0f3c2 100644
--- a/base/lthooks.dtx
+++ b/base/lthooks.dtx
@@ -1874,6 +1874,34 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\@@_tl_set:Nn,\@@_tl_set:cn,\@@_tl_set:cx}
+% \begin{macro}{\@@_tl_gset:Nn,\@@_tl_gset:cn,\@@_tl_gset:co,\@@_tl_gset:cx}
+% \begin{macro}{\@@_tl_gput_right:Nn,\@@_tl_gput_right:No,\@@_tl_gput_right:cn}
+% \begin{macro}{\@@_tl_gput_left:Nn,\@@_tl_gput_left:No}
+% \begin{macro}{\@@_tl_gclear:N,\@@_tl_gclear:c}
+% \begin{macro}{\@@_tl_gset_eq:NN}
+%   Scan mark used for delimited arguments.
+%    \begin{macrocode}
+\cs_new_eq:NN \@@_tl_set:Nn \tl_set:Nn
+\cs_generate_variant:Nn \@@_tl_set:Nn { cn, cx }
+\cs_new_eq:NN \@@_tl_gset:Nn \tl_gset:Nn
+\cs_generate_variant:Nn \@@_tl_gset:Nn { cn, co, cx }
+\cs_new_eq:NN \@@_tl_gput_right:Nn \tl_gput_right:Nn
+\cs_generate_variant:Nn \@@_tl_gput_right:Nn { No, cn }
+\cs_new_eq:NN \@@_tl_gput_left:Nn \tl_gput_left:Nn
+\cs_generate_variant:Nn \@@_tl_gput_left:Nn { No }
+\cs_new_protected:Npn \@@_tl_gclear:N #1
+  { \@@_tl_gset_eq:NN #1 \c_empty_tl }
+\cs_generate_variant:Nn \@@_tl_gclear:N { c }
+\cs_new_eq:NN \@@_tl_gset_eq:NN \tl_gset_eq:NN
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
 %
 % \subsection{Providing new hooks}
 %
@@ -2059,13 +2087,6 @@
 \cs_new_protected:Npn \@@_include_legacy_code_chunk:n #1
   {
 %    \end{macrocode}
-%    If the \pkg{expl3} code is run with checking on then assigning or
-%    using non L3 names such as \cs{@enddocumenthook} with \pkg{expl3}
-%    functions will trigger warnings so we run this code with
-%    debugging explicitly suspended.
-%    \begin{macrocode}
-    \debug_suspend:
-%    \end{macrocode}
 %    If the macro doesn't exist (which is the usual case) then nothing
 %    needs to be done.
 %    \begin{macrocode}
@@ -2083,10 +2104,9 @@
 %    Once added to the hook, we need to clear it otherwise it might
 %    get added again  later if the hook data gets updated.
 %    \begin{macrocode}
-            \tl_gclear:c { @#1hook }
+            \@@_tl_gclear:c { @#1hook }
           }
       }
-    \debug_resume:
   }
 %    \end{macrocode}
 % \end{macro}
@@ -2328,14 +2348,12 @@
       {
         \str_if_eq:eeTF { top-level } { \@@_currname_or_default: }
           {
-            \debug_suspend:
 %    \end{macrocode}
 %    If the hook's basic structure does not exist, we need to declare it
 %    with \cs{@@_declare:n}.
 %    \begin{macrocode}
             \@@_declare:n {#1}
-            \tl_gput_right:cn { @@_toplevel~#1 } {#3}
-            \debug_resume:
+            \@@_tl_gput_right:cn { @@_toplevel~#1 } {#3}
           }
           { \msg_error:nnn { hooks } { misused-top-level } {#1} }
       }
@@ -2560,14 +2578,12 @@
 %    hook before its defined (see section~\ref{sec:querying}).
 %    \begin{macrocode}
     \@@_if_exist:nTF {#1}
+      {
 %    \end{macrocode}
 %    Then remove the chunk and run \cs{@@_update_hook_code:n} so
 %    that the execution token list reflects the change if we are after
 %    \verb=\begin{document}=.
-%    \begin{macrocode}
-      {
-        \debug_suspend:
-%    \end{macrocode}
+%
 %    If all code is to be removed, clear the code pool
 %    \cs[no-index]{g_@@_\meta{hook}_code_prop}, the top-level code
 %    \cs[no-index]{@@_toplevel~\meta{hook}}, and the next-execution code
@@ -2576,8 +2592,8 @@
         \str_if_eq:nnTF {#2} {*}
           {
             \prop_gclear:c { g_@@_#1_code_prop }
-            \tl_gclear:c { @@_toplevel~#1 }
-            \tl_gclear:c { @@_next~#1 }
+            \@@_tl_gclear:c { @@_toplevel~#1 }
+            \@@_tl_gclear:c { @@_next~#1 }
           }
           {
 %    \end{macrocode}
@@ -2592,7 +2608,7 @@
 %    cleared unconditionally.
 %    \begin{macrocode}
             \str_if_eq:nnTF {#2} { top-level }
-              { \tl_gclear:c { @@_toplevel~#1 } }
+              { \@@_tl_gclear:c { @@_toplevel~#1 } }
               {
 %    \end{macrocode}
 %    Otherwise check if the label being removed exists in the code pool.
@@ -2605,7 +2621,6 @@
                       {#1} {#2}
               }
           }
-        \debug_resume:
 %    \end{macrocode}
 %    Finally update the code, if the hook exists.
 %    \begin{macrocode}
@@ -2759,7 +2774,6 @@
 %    Then we call the function to handle the given rule. Throw an error if the
 %    rule is invalid.
 %    \begin{macrocode}
-    \debug_suspend:
     \cs_if_exist_use:cTF { @@_rule_#3_gset:nnn }
       {
           {#1} {#2} {#4}
@@ -2767,7 +2781,6 @@
       }
       { \msg_error:nnnnnn { hooks } { unknown-rule }
                           {#1} {#2} {#3} {#4}        }
-    \debug_resume:
   }
 %    \end{macrocode}
 % \end{macro}
@@ -2793,7 +2806,7 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_rule_before_gset:nnn #1#2#3
   {
-    \tl_gset:cx { g_@@_#1_rule_ \@@_label_pair:nn {#2} {#3} _tl }
+    \@@_tl_gset:cx { g_@@_#1_rule_ \@@_label_pair:nn {#2} {#3} _tl }
       { \@@_label_ordered:nnTF {#2} {#3} { < } { > } }
   }
 \cs_new_eq:cN { @@_rule_<_gset:nnn } \@@_rule_before_gset:nnn
@@ -2802,7 +2815,7 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_rule_after_gset:nnn #1#2#3
   {
-    \tl_gset:cx { g_@@_#1_rule_ \@@_label_pair:nn {#3} {#2} _tl }
+    \@@_tl_gset:cx { g_@@_#1_rule_ \@@_label_pair:nn {#3} {#2} _tl }
       { \@@_label_ordered:nnTF {#3} {#2} { < } { > } }
   }
 \cs_new_eq:cN { @@_rule_>_gset:nnn } \@@_rule_after_gset:nnn
@@ -2815,7 +2828,7 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_rule_voids_gset:nnn #1#2#3
   {
-    \tl_gset:cx { g_@@_#1_rule_ \@@_label_pair:nn {#2} {#3} _tl }
+    \@@_tl_gset:cx { g_@@_#1_rule_ \@@_label_pair:nn {#2} {#3} _tl }
       { \@@_label_ordered:nnTF {#2} {#3} { -> } { <- } }
   }
 %    \end{macrocode}
@@ -2829,9 +2842,9 @@
 %   together in hook |#1|.
 %    \begin{macrocode}
 \cs_new_protected:cpn { @@_rule_incompatible-error_gset:nnn } #1#2#3
-  { \tl_gset:cn { g_@@_#1_rule_ \@@_label_pair:nn {#2} {#3} _tl } { xE } }
+  { \@@_tl_gset:cn { g_@@_#1_rule_ \@@_label_pair:nn {#2} {#3} _tl } { xE } }
 \cs_new_protected:cpn { @@_rule_incompatible-warning_gset:nnn } #1#2#3
-  { \tl_gset:cn { g_@@_#1_rule_ \@@_label_pair:nn {#2} {#3} _tl } { xW } }
+  { \@@_tl_gset:cn { g_@@_#1_rule_ \@@_label_pair:nn {#2} {#3} _tl } { xW } }
 %    \end{macrocode}
 %  \end{macro}
 %
@@ -2954,7 +2967,6 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_initialize_hook_code:n #1
   {
-    \debug_suspend:
     \@@_debug:n{ \iow_term:x{^^JUpdate~ code~ for~ hook~
                                     '#1' \on at line :^^J} }
 %    \end{macrocode}
@@ -2979,7 +2991,7 @@
       {
         \prop_if_empty:cTF {g_@@_#1_code_prop}
           {
-            \tl_gset:co { @@~#1 }
+            \@@_tl_gset:co { @@~#1 }
               {
                 \cs:w @@_toplevel~#1 \exp_after:wN \cs_end:
                 \cs:w @@_next~#1 \cs_end:
@@ -2995,9 +3007,9 @@
 %    in preparation is to change two definitions used later on.
 %    \begin{macrocode}
             \@@_if_reversed:nTF {#1}
-              { \cs_set_eq:NN \@@_tl_gput:Nn    \tl_gput_left:Nn
+              { \cs_set_eq:NN \@@_tl_gput:Nn    \@@_tl_gput_left:Nn
                 \cs_set_eq:NN \@@_clist_gput:NV \clist_gput_left:NV  }
-              { \cs_set_eq:NN \@@_tl_gput:Nn    \tl_gput_right:Nn
+              { \cs_set_eq:NN \@@_tl_gput:Nn    \@@_tl_gput_right:Nn
                 \cs_set_eq:NN \@@_clist_gput:NV \clist_gput_right:NV }
 %    \end{macrocode}
 %
@@ -3020,7 +3032,6 @@
                                        \g_@@_used_prop {#1}{} }
           }
       }
-    \debug_resume:
   }
 %    \end{macrocode}
 %  \end{macro}
@@ -3124,7 +3135,7 @@
        {
          \int_incr:N \l_@@_labels_int
          \seq_put_right:Nn \l_@@_labels_seq {##1}
-         \tl_set:cn { \@@_tl_csname:n {##1} } { 0 }
+         \@@_tl_set:cn { \@@_tl_csname:n {##1} } { 0 }
          \seq_clear_new:c { \@@_seq_csname:n {##1} }
        }
 %    \end{macrocode}
@@ -3177,7 +3188,7 @@
 %    \end{macrocode}
 %    
 %    \begin{macrocode}
-    \tl_gclear:N #1
+    \@@_tl_gclear:N #1
     \clist_gclear:N #2
 %    \end{macrocode}
 %
@@ -3248,7 +3259,7 @@
 %    chunk added).  The |next| code is always added last.
 %    \begin{macrocode}
     \exp_args:NNo \@@_tl_gput:Nn #1 { \cs:w @@_toplevel~#3 \cs_end: }
-    \tl_gput_right:No #1 { \cs:w @@_next~#3 \cs_end: }
+    \@@_tl_gput_right:No #1 { \cs:w @@_next~#3 \cs_end: }
   }
 %    \end{macrocode}
 %
@@ -3713,12 +3724,10 @@
   { \@@_normalize_hook_args:Nn \@@_gput_next_code:nn {#1} }
 \cs_new_protected:Npn \@@_gput_next_code:nn #1 #2
   {
-    \debug_suspend:
     \@@_declare:n {#1}
     \hook_if_exist:nTF {#1}
       { \@@_gput_next_do:nn {#1} {#2} }
       { \@@_try_declaring_generic_next_hook:nn {#1} {#2} }
-    \debug_resume:
   }
 \cs_new_protected:Npn \@@_gput_next_do:nn #1
   {
@@ -3741,8 +3750,8 @@
     \tl_if_empty:cT { @@~#2 }
       { \@@_update_hook_code:n {#2} }
     \tl_if_empty:NT #1
-      { \tl_gset:Nn #1 { \@@_clear_next:n {#2} } }
-    \tl_gput_right:Nn #1
+      { \@@_tl_gset:Nn #1 { \@@_clear_next:n {#2} } }
+    \@@_tl_gput_right:Nn #1
   }
 \cs_new_protected:Npn \@@_clear_next:n #1
   { \cs_gset_eq:cN { @@_next~#1 } \c_empty_tl }





More information about the latex3-commits mailing list.