[latex3-commits] [git/LaTeX3-latex3-latex2e] callback_rules: Add news (86f5d1d0)
Marcel Fabian Krüger
tex at 2krueger.de
Sun Sep 4 23:24:11 CEST 2022
Repository : https://github.com/latex3/latex2e
On branch : callback_rules
Link : https://github.com/latex3/latex2e/commit/86f5d1d0e74ae473448aabebb26de762e5f6dbd4
>---------------------------------------------------------------
commit 86f5d1d0e74ae473448aabebb26de762e5f6dbd4
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date: Sun Sep 4 23:24:11 2022 +0200
Add news
>---------------------------------------------------------------
86f5d1d0e74ae473448aabebb26de762e5f6dbd4
base/doc/ltnews36.tex | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/base/doc/ltnews36.tex b/base/doc/ltnews36.tex
index 20d10b47..44ee61b2 100644
--- a/base/doc/ltnews36.tex
+++ b/base/doc/ltnews36.tex
@@ -268,6 +268,37 @@ approach.
\githubissue{903}
+
+\subsection{Rule based ordering for \LuaTeX\ callback handlers}
+
+In \hologo{LuaLaTeX} the callback handlers used to be called in the order
+they are registered in, but this was often rather fragile.
+It depends a lot on the load order and any attempts to enforce a
+different order required to unregister and reregister the handlers to
+be reordered. Additionally even if some ordering constraints where
+enforced that way another package loaded later could accidentally
+overwrite it.
+
+To improve this, we now order the callback handlers based on ordering
+rules similar to the hook rules.
+
+When registering a callback which should run before or after another
+callback, \verb+luatexbase.declare_callback_rule+ can now be used to
+record this ordering constraint.
+For example
+\begin{verbatim}
+ luatexbase.add_to_callback('pre_shaping_filter', my_handler, 'my_name')
+ luatexbase.declare_callback_rule('pre_shaping_filter', 'my_name', 'before', 'other_name')
+\end{verbatim}
+will ensure that \verb+my_handler+ will always be called before the
+handler registered as \verb+other_name+.
+
+This also means that the order in which callbacks are registered no
+longer implicitly defines an order.
+Code which relied on this implicit order should now define the order
+rules explicitly.
+
+
\section{Bug fixes}
More information about the latex3-commits
mailing list.