# Re: [NTG-context] The very last macro

luigi scarso wrote:

why, what do you want to achieve; there are already such hooks

The original request was
sorry for the noise :
is there in mkiv a very last macro ?
I mean something like
\IamCallAtTheReallyEnd{..}
which does absolutly nothing to the pdf , and  after  which mkiv ends
without calls any other macro

Peter suggest to use \everylastshipout;
but this

\def\LuigisWhateverShouldHappen{\immediate\write16{BOOOM!}Something
Luigi want to do for some unknown reason.\immediate\write16{BOOOM!}}

\appendtoks\LuigisWhateverShouldHappen \to \everylastshipout
\starttext
hello
\stoptext

write
Something Luigi want to do for some unknown reason.

near the bottom of pdf (and I don't want it)
and BOOM! on log (which is a way to say that this macro was called)


the problem is in your definition of 'end' and 'bottom'


the real final thing is \end and \everygoodbye happens just before that (the only calls after it are postponed error messages, which have no consequence for any pdf and the primitive \end which is really needed)


of course there can be pending conditional branches that needs to be finished; just try \appendtoks\tracingall\to\everygoodbye

You can also do something

\startluacode
table.insert(input.stop_actions, function()
texio.write_nl("I still have no clue why you need it.")
end)
\stopluacode


any other hook in itself will introduce a new situation of 'something done before the real \end'

Hans

-----------------------------------------------------------------
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________