[lltx] luatexbase.is_in_callback

Arno Trautmann Arno.Trautmann at gmx.de
Thu Jul 21 14:11:17 CEST 2011


Hi all,

I'd like to use the post_linebreak_filter to manipulate the node list, 
but only if a macro appears in that given paragraph. The straightforward 
way would be to let the macro register the function; however, using 
luatexbase.add_to_callback then gives an error if the macro is called 
twice. (which is allowed in the code)
Now, I could change the macro not to register anymore once called and 
set it back at the beginning of the next paragraph, but a much nicer way 
would be to have a function that checks if a function is already 
registered and does not throw an error.
In the end, what I'm asking for are two functions like
luatexbase.is_in_callback(name,func),
returning true or false, actually executing this code from the current 
package:

if priority_in_callback(name, description) then
err("function ’%s’ already registered\nin callback ’%s’",
description, name)
return
end

and

luatexbase.provide_callback(name,func,description,priority),

also returning true or false and registering the function if it is not 
already.

Is it possible to add this to luatexbase? It would be a very nice 
feature, but I don't know if many people would really need it …

Cheers
Arno


More information about the lualatex-dev mailing list