[latex3-commits] [git/LaTeX3-latex3-latex3] master: Each hook entry should be unique (e504dbd)

Joseph Wright joseph.wright at morningstar2.co.uk
Fri Jun 7 10:16:42 CEST 2019


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/e504dbd84c4619bddf3b4c53c90db91a8f0f2612

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

commit e504dbd84c4619bddf3b4c53c90db91a8f0f2612
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri Jun 7 09:16:42 2019 +0100

    Each hook entry should be unique


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

e504dbd84c4619bddf3b4c53c90db91a8f0f2612
 l3trial/l3hooks/l3hooks.dtx              |    6 ++++++
 l3trial/l3hooks/testfiles/m3hooks001.tlg |    6 ------
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/l3trial/l3hooks/l3hooks.dtx b/l3trial/l3hooks/l3hooks.dtx
index a57767d..0f166ff 100644
--- a/l3trial/l3hooks/l3hooks.dtx
+++ b/l3trial/l3hooks/l3hooks.dtx
@@ -78,6 +78,10 @@
 %     \cs{hook_gadd_all:nnnn} \Arg{module-a} \Arg{hook} \Arg{module-b} \Arg{code}
 %     \cs{hook_gadd_all:nnnnn} \Arg{module-a} \Arg{hook} \Arg{module-b} \Arg{desc} \Arg{code}
 %   \end{syntax}
+%   Adds an entry to the \meta{hook} which will execute the \meta{code} from
+%   \meta{module-b}. Each entry must be unique, and thus repeated use of the
+%   same \meta{module-b} (or \meta{module-b}/\meta{desc}) will overwrite older
+%   entries. Entries are added at the \emph{end} of the hook.
 % \end{function}
 %
 % \begin{function}[added = 2019-06-03]{\hook_use:nn}
@@ -185,6 +189,7 @@
   {
     \seq_if_exist:cTF { g_@@_next_ #2 _ #3 _seq }
       {
+        \seq_gremove_all:cn { g_@@_ #1 _ #2 _ #3 _seq } {#4}
         \seq_gput_right:cn { g_@@_ #1 _ #2 _ #3 _seq } {#4}
         \prop_gput:cnn { g_@@_ #1 _ #2 _ #3 _prop } {#4} {#5}
       }
@@ -278,6 +283,7 @@
               {  document-hook-used } {#1} { add~to }
           }
           {
+            \seq_gremove_all:cn { g_@@_document_ #1 _seq } {#2}
             \seq_gput_right:cn { g_@@_document_ #1 _seq } {#2}
             \prop_gput:cnn { g_@@_document_ #1 _prop } {#2} {#3}
           }
diff --git a/l3trial/l3hooks/testfiles/m3hooks001.tlg b/l3trial/l3hooks/testfiles/m3hooks001.tlg
index 6b7b549..9f6d3f9 100644
--- a/l3trial/l3hooks/testfiles/m3hooks001.tlg
+++ b/l3trial/l3hooks/testfiles/m3hooks001.tlg
@@ -71,18 +71,12 @@ l. ...  }
 > that.
 <recently read> }
 l. ...  }
-> that.
-<recently read> }
-l. ...  }
 > the other.
 <recently read> }
 l. ...  }
 > that.
 <recently read> }
 l. ...  }
-> that.
-<recently read> }
-l. ...  }
 > the other.
 <recently read> }
 l. ...  }





More information about the latex3-commits mailing list