Skip to content

Commit

Permalink
Refuse sorting one-time hooks
Browse files Browse the repository at this point in the history
Fixes #818
  • Loading branch information
PhelypeOleinik committed May 17, 2022
1 parent 6a4da42 commit 6548ebe
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions base/lthooks.dtx
Expand Up @@ -31,8 +31,8 @@
%%% From File: lthooks.dtx
%
% \begin{macrocode}
\def\lthooksversion{v1.0t}
\def\lthooksdate{2022/04/14}
\def\lthooksversion{v1.0u}
\def\lthooksdate{2022/05/17}
% \end{macrocode}
%
%<*driver>
Expand Down Expand Up @@ -3843,8 +3843,8 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_initialize_hook_code:n #1
{
\@@_debug:n{ \iow_term:x{^^JUpdate~ code~ for~ hook~
'#1' \on@line :^^J} }
\@@_debug:n
{ \iow_term:x { ^^J Update~code~for~hook~'#1' \on@line :^^J } }
% \end{macrocode}
% This does the sorting and the updates.
% First thing we do is to check if a legacy hook macro exists and
Expand All @@ -3862,8 +3862,11 @@
% \cs{@@_initialize_single:NNn} and pass to it ready made csnames
% as they are needed several times inside. This way we save a bit
% on processing time if we do that up front.
% \changes{v1.0u}{2022/05/17}{Refuse sorting one-time hooks (gh/818).}
% \begin{macrocode}
\@@_if_usable:nT {#1}
\bool_lazy_and:nnT
{ \@@_if_usable_p:n {#1} }
{ ! \@@_if_execute_immediately_p:n {#1} }
{
\prop_if_empty:cTF { g_@@_#1_code_prop }
{
Expand All @@ -3876,7 +3879,7 @@
{
% \end{macrocode}
% By default the algorithm sorts the code chunks and then saves the
% result in a token list for fast execution; this is done by adding the code chunks
% result in a token list for fast execution; this is done by adding the code chunks
% one after another, using \cs{tl_gput_right:NV}. When we sort code for
% a reversed hook, all we have to do is to add the code chunks in
% the opposite order into the token list. So all we have to do
Expand Down Expand Up @@ -4323,16 +4326,17 @@
% \@@_apply_-rule_>:nnn,
% \@@_apply_-rule_<-:nnn,
% \@@_apply_-rule_->:nnn,
% \@@_apply_-rule_x:nnn,
% \@@_apply_-rule_xW:nnn,
% \@@_apply_-rule_xE:nnn,
% }
% Reversed rules.
% \begin{macrocode}
\cs_new_eq:cc { @@_apply_-rule_<:nnn } { @@_apply_rule_>:nnn }
\cs_new_eq:cc { @@_apply_-rule_>:nnn } { @@_apply_rule_<:nnn }
\cs_new_eq:cc { @@_apply_-rule_<:nnn } { @@_apply_rule_>:nnn }
\cs_new_eq:cc { @@_apply_-rule_>:nnn } { @@_apply_rule_<:nnn }
\cs_new_eq:cc { @@_apply_-rule_<-:nnn } { @@_apply_rule_<-:nnn }
\cs_new_eq:cc { @@_apply_-rule_->:nnn } { @@_apply_rule_->:nnn }
\cs_new_eq:cc { @@_apply_-rule_xE:nnn } { @@_apply_rule_xE:nnn }
\cs_new_eq:cc { @@_apply_-rule_xW:nnn } { @@_apply_rule_xW:nnn }
\cs_new_eq:cc { @@_apply_-rule_xE:nnn } { @@_apply_rule_xE:nnn }
\cs_new_eq:cc { @@_apply_-rule_xW:nnn } { @@_apply_rule_xW:nnn }
% \end{macrocode}
% \end{macro}
%
Expand Down Expand Up @@ -4875,7 +4879,7 @@
% empty.
% \changes{v1.0r}{2021/09/06}{Macro added (gh/606)}
% \begin{macrocode}
\prg_new_conditional:Npnn \@@_if_execute_immediately:n #1 { F, TF }
\prg_new_conditional:Npnn \@@_if_execute_immediately:n #1 { p, F, TF }
{
\@@_if_usable:nTF {#1}
{
Expand Down

0 comments on commit 6548ebe

Please sign in to comment.