latex3 / latex2e

The LaTeX2e kernel
https://www.latex-project.org/
LaTeX Project Public License v1.3c
1.93k stars 266 forks source link

ltluatex: allow observers next to exclusive callbacks #809

Open jlaurens opened 2 years ago

jlaurens commented 2 years ago

Brief outline of the enhancement

Due to exclusiveness, there can't be 2 different callbacks for the find_read_file key. It would be great if we had the possibility to have simple callbacks next to the exclusive one. That would allow, for example, to simply collect the file names independently.

Something like add_simple_to_callback, remove_simple_from_callback would help on the API side.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity.

lemzwerg commented 1 year ago

I support that. Working on the 'nodetree' debugging tool, which non-intrusively tries to analyze callbacks, I will have to add a lot of extra code to add observers before and after the actual callback to circumvent the 'exclusive' type.

github-actions[bot] commented 12 months ago

This issue has been automatically marked as stale because it has not had recent activity.

zauguin commented 1 week ago

Having a general function for this comes with the issue that different exclusive callbacks behave rather different and also need quite different handling. E.g. linebreak_filter does not need any additional callbacks (you can just use pre_/post_linebreak_filter), the find_..._file callbacks need interceptors both before and after the callback (to see both the original and looked up name) and potentially need a way to modify the values, open_read_file can't be observed without completely changing how file reading works with potentially significant performance implications.

Therefore these need some individual handling similar to what is done for mlist_to_hlist. Please add explicit feature requests with usecases which callbacks are useful to observe and which values you are interested in.