[latex3-commits] [git/LaTeX3-latex3-latex2e] hotfix/gh441: Remark on the difference in behaviour when removing code (8fe7a893)

PhelypeOleinik phelype.oleinik at latex-project.org
Mon Dec 14 03:23:37 CET 2020


Repository : https://github.com/latex3/latex2e
On branch  : hotfix/gh441
Link       : https://github.com/latex3/latex2e/commit/8fe7a893b0eef9f0ae1d0e2438a7db957997e755

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

commit 8fe7a893b0eef9f0ae1d0e2438a7db957997e755
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date:   Sun Dec 13 23:23:37 2020 -0300

    Remark on the difference in behaviour when removing code


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

8fe7a893b0eef9f0ae1d0e2438a7db957997e755
 base/lthooks.dtx | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/base/lthooks.dtx b/base/lthooks.dtx
index 0726a0aa..9aa3d48d 100644
--- a/base/lthooks.dtx
+++ b/base/lthooks.dtx
@@ -2480,14 +2480,23 @@
           {
 %    \end{macrocode}
 %    If the label is |top-level| then clear the token list, as all code
-%    there is under the same label.
-%    Otherwise check if the label being removed exists in the code pool.
-%    If it does, just call \cs{@@_gremove_code_do:nn} to do the removal,
-%    otherwise mark it to be removed.
+%    there is under the same label.  Marked removal is not implemented
+%    for |top-level| because it is hard to reliably know that no code
+%    was added to \cs[no-index]{@@_toplevel~\meta{hook}} (granted that
+%    an empty code could be interpreted as that, but then it differs in
+%    behaviour from other labels, in which an empty chunk is still valid
+%    for removal).  Besides, it doesn't make much (if any) sense to
+%    packages to remove |top-level| code.  So here the chunk is just
+%    cleared unconditionally.
 %    \begin{macrocode}
             \str_if_eq:nnTF {#2} { top-level }
               { \tl_gclear:c { @@_toplevel~#1 } }
               {
+%    \end{macrocode}
+%    Otherwise check if the label being removed exists in the code pool.
+%    If it does, just call \cs{@@_gremove_code_do:nn} to do the removal,
+%    otherwise mark it to be removed.
+%    \begin{macrocode}
                 \prop_get:cnNTF { g_@@_#1_code_prop } {#2} \l_@@_return_tl
                   { \@@_gremove_code_do:nn }
                   { \@@_mark_removal:nn }





More information about the latex3-commits mailing list.