On Wed, Oct 02, 2019 at 04:04:50PM +0300, Linas Stonys wrote:
Here is an example of what I'm talking about: \documentclass{article} \directlua{ luatexbase.add_to_callback('mlist_to_hlist', function (h, d, p) print ("I'm here") return node.mlist_to_hlist(h, d, p) end, 'mlist modifier') }
\usepackage[color=no]{nodetree} \nodetreeregister{mhlist}
\begin{document} $a$ \end{document}
Right. I think there are two parts: Instead of passing a hlist to mlist_to_hlist, adding a second mlist_to_hlist should fail to make it easier to debug the code. I added a bug for this to the LaTeX tracker (https://github.com/latex3/latex2e/issues/188) The other thing you suggest is adding additional pre/post callbacks (similar to pre/post_linebreak_filter) to allow multiple packages to use mlist_to_hlist, right? I think that this is a good idea (also for some other callbacks) but it makes sense to implement this in a package instead of in the LaTeX kernel first to allow some experiments in getting the interface right. Anyways, in my opinion think we should continue this discussion on the LaTeX bug tracker or the LaTeX mailing list (LATEX-L@listserv.uni-heidelberg.de) because it is about how LaTeX deals with LuaTeX callbacks and not about the LuaTeX engine directly. Best regards, Marcel