# [lltx] luatexbase.is_in_callback

Arno Trautmann Arno.Trautmann at gmx.de
Thu Jul 21 14:34:35 CEST 2011

```Patrick Gundlach wrote:
> Am 21.07.2011 um 14:11 schrieb Arno Trautmann:
>> I'd like to use the post_linebreak_filter to manipulate the node list, but only if a macro appears in that given paragraph.
>
> Can you use attributes there? Then you can test whether certain attributes are in a paragraph and apply your code.

Yes, and I do in fact. But I'm not sure how this solves my problem here?
Maybe I'll be more precise on what I want to do:
I've written a function randomcolor that inserts a color whatsit before
(push) and after (pull) every glyph in a paragraph, using the
post_linebreak_filter. Now I want to provide a command
\textrandomcolor{} that does the same, but only with the text in the
argument. For this, I use the same function as above, but set an
attribute at the beginning of the argument and unset it at the end, and
in the function, I test for this attribute. Fine.
However, in a paragraph that does /not/ contain any \textrandomcolor, I
don't want the function to loop through all nodes. Let's say, for
performance reasons …