latex2e icon indicating copy to clipboard operation
latex2e copied to clipboard

ltluatex: make a data callback first

Open jlaurens opened this issue 2 years ago • 3 comments

Brief outline of the enhancement

For callbacks of type 'data', the input and the output may differ. When one callback is expecting some specific format, it may have problems if some 3rd party has already modified the input. One solution is to have the callback called first, then we are sure that the input is not modified. For that we can remove and save all the callbacks, add our own, then add the saved ones. A built-in solution would be welcome, add_to_callback_first for example, that would simply insert the callback at the beginning of the storage instead of the end.

Another solution would be to push/pop all the callbacks but that might be too extreme in a collaborative context.

jlaurens avatar May 06 '22 19:05 jlaurens

if you use the luatexbase package there is a compatibility layer that provides:

% \DescribeMacro{add\_to\_callback}\meta{name}\meta{function}\meta{description}\meta{priority}\\%
% This function is defined as a wrapper around the kernel-level
% implementation, which does not have the fourth \meta{priority}
% argument. 
% In general the \texttt{priority} argument is implemented by 
% temporarily removing some callbacks from the list and replacing
% them after having added the new callback.

We didn't copy the origial luatexbase priority mechanism into ltluatex, but re-implemented it in the "new" luatexbase package which is a thin wrapper around ltluatex. I think this should do what you want here

davidcarlisle avatar May 06 '22 19:05 davidcarlisle

Thanks Maybe the ltluatex documentation can better highlight luatexbase.sty. Actually it is hidden in the Plain TeX section... and like many people, I very seldomly read Plain TeX sections ;-)

jlaurens avatar May 06 '22 22:05 jlaurens

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

stale[bot] avatar Jul 10 '22 08:07 stale[bot]