[latex3-commits] [git/LaTeX3-latex3-latex2e] apdf161: Simplify a bit \@@_make_name:n (e6a1a69e)

PhelypeOleinik phelype.oleinik at latex-project.org
Wed Sep 9 15:57:14 CEST 2020


Repository : https://github.com/latex3/latex2e
On branch  : apdf161
Link       : https://github.com/latex3/latex2e/commit/e6a1a69e70510635324ac75e51f8bda61e1c14d9

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

commit e6a1a69e70510635324ac75e51f8bda61e1c14d9
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date:   Wed Sep 9 10:57:14 2020 -0300

    Simplify a bit \@@_make_name:n


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

e6a1a69e70510635324ac75e51f8bda61e1c14d9
 base/lthooks.dtx | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/base/lthooks.dtx b/base/lthooks.dtx
index 40480f1d..52649351 100644
--- a/base/lthooks.dtx
+++ b/base/lthooks.dtx
@@ -1688,38 +1688,40 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \hook_new:n #1
   { \@@_normalize_hook_args:Nn \@@_new:n {#1} }
-\cs_new_protected:Npn \@@_new:n #1 {
+\cs_new_protected:Npn \@@_new:n #1
+  {
 %    \end{macrocode}
 %    We check for one of the internal data structures and if it
 %    already exists we complain.
 %    \begin{macrocode}
-  \hook_if_exist:nTF {#1}
-       { \msg_error:nnn { hooks } { exists } {#1} }
+    \hook_if_exist:nTF {#1}
+      { \msg_error:nnn { hooks } { exists } {#1} }
 %    \end{macrocode}
 %    Otherwise we add the hook name to the list of all hooks and
 %    allocate the necessary data structures for the new hook.
 %    \begin{macrocode}
-     { \seq_gput_right:Nn \g_@@_all_seq {#1}
+      {
+        \seq_gput_right:Nn \g_@@_all_seq {#1}
 %    \end{macrocode}
 %    This is only used by the actual code of the current hook, so
 %    declare it normally:
 %    \begin{macrocode}
-       \tl_new:c { @@~#1 }
+        \tl_new:c { @@~#1 }
 %    \end{macrocode}
 %    Now ensure that the base data structure for the hook exists:
 %    \begin{macrocode}
-       \@@_declare:n {#1}
+        \@@_declare:n {#1}
 %    \end{macrocode}
 %    The \cs{g_@@_\meta{hook}_labels_clist} holds the sorted list of
 %    labels (once it got sorted). This is used only for debugging.
 %    \begin{macrocode}
-       \clist_new:c {g_@@_#1_labels_clist}
+        \clist_new:c {g_@@_#1_labels_clist}
 %    \end{macrocode}
 %    Some hooks should reverse the default order of code chunks. To
 %    signal this we have a token list which is empty for normal hooks
 %    and contains a \verb=-= for reversed hooks.
 %    \begin{macrocode}
-       \tl_new:c { g_@@_#1_reversed_tl }
+        \tl_new:c { g_@@_#1_reversed_tl }
 %    \end{macrocode}
 %    The above is all in L3 convention, but we also provide an
 %    interface to legacy \LaTeXe{} hooks of the form \cs{@...hook},
@@ -1734,9 +1736,9 @@
 %    \end{quote}
 %
 %    \begin{macrocode}
-       \@@_include_legacy_code_chunk:n {#1}
+        \@@_include_legacy_code_chunk:n {#1}
      }
-}
+  }
 %    \end{macrocode}
 %  \end{macro}
 %
@@ -1939,9 +1941,10 @@
 \cs_new:Npn \@@_make_name:n #1
   {
     \exp_after:wN \exp_after:wN \exp_after:wN \@@_make_name:w
-    \exp_after:wN \token_to_str:N \cs:w g@@ ~ #1 \cs_end:
+    \exp_after:wN \token_to_str:N \cs:w @@~ #1 \cs_end:
   }
-\cs_new:Npn \@@_make_name:w #1#2 ~ { }
+\exp_last_unbraced:NNNNo
+\cs_new:Npn \@@_make_name:w #1 \tl_to_str:n { @@~ } { }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -2678,8 +2681,8 @@
     \hook_if_exist:nT {#1}
       {
         \prop_if_empty:cTF {g_@@_#1_code_prop}
-          { \tl_gset:co {@@~#1}
-                        {\cs:w g_@@_#1_code_next_tl \cs_end: } }
+          { \tl_gset:co { @@~#1 }
+                        { \cs:w g_@@_#1_code_next_tl \cs_end: } }
           {
 %    \end{macrocode}
 %    By default the algorithm sorts the code chunks and then saves the
@@ -3419,9 +3422,9 @@
     \else:
       \@@_use_undefined:w
     \fi:
-    \cs:w @@~ \use:n {#1}  \cs_end:
+    \cs:w @@~#1 \cs_end:
   }
-\cs_new:Npn \@@_use_undefined:w #1 #2 \use:n #3 #4 \cs_end:
+\cs_new:Npn \@@_use_undefined:w #1 #2 @@~#3 \cs_end:
   {
     #1 % fi
     \@@_use:wn #3 / \s_@@_mark {#3}





More information about the latex3-commits mailing list.