diff --git a/base/changes.txt b/base/changes.txt index f666bec55..5cfdc54db 100644 --- a/base/changes.txt +++ b/base/changes.txt @@ -6,6 +6,12 @@ completeness or accuracy and it contains some references to files that are not part of the distribution. ================================================================================ +2021-07-20 Phelype Oleinik + + * lthooks.dtx: + Simplify \RemoveFromHook to not queue the removal of code chunks + that aren't yet in the hook (gh/625). + 2021-07-20 Phelype Oleinik * ltcmdhooks.dtx: @@ -16,11 +22,11 @@ are not part of the distribution. * ltplain.dtx (section{Plain \TeX}): Use 2 as value for \tracinglostchars so that one gets at least warnings on the terminal (3 would be better as a missing char is an error) - + 2021-07-12 David Carlisle * ltclass.dtx: fix for gh/617 prevent expansion in raw option list. - + 2021-07-11 Frank Mittelbach * lterror.dtx (subsection{General commands}): diff --git a/base/doc/ltnews34.tex b/base/doc/ltnews34.tex index 5041f5839..e16828f80 100644 --- a/base/doc/ltnews34.tex +++ b/base/doc/ltnews34.tex @@ -142,6 +142,30 @@ \section{???} \emph{write} +\section{Hook business} + +\subsection{Changed how \cs{RemoveFromHook} treats code that isn't in the hook} + +In the first version of \cs{RemoveFromHook}, in case the code label +being removed didn't exist in the hook, a ``removal order'' would be +queued, and the next time something tried to add that label to the hook, +the \cs{AddToHook} would be cancelled by the removal order, and no code +would be added that once. This was so that in principle package loading +order wouldn't matter. However this implementation didn't work quite as +intended, because while two \cs{AddToHook} to a given label would be +removed by a single \cs{RemoveFromHook}, one \cs{RemoveFromHook} could +not cancel two \cs{AddToHook} to that label, and this asymmetry caused +confusion and was a recipe for further problems. + +The implementation was changed and now \cs{RemoveFromHook} only removes +labels that already exist in a hook, and will raise error if they don't. +For usage across packages, for removing code in a hook, the +\texttt{voids} relation should be used instead: this relation is +non-destructive (meaning it can be later reverted with another one), and +it is truly independent of package loading order, so it should be +preferred. +% +\githubissue{625} \section{New or improved commands}